Java program to declare an integer array and initializing it

Assignment Help Computer Engineering
Reference no: EM1321481

Write down a complete Java program that declares an integer array, intArray, and initialize it to {1, 2, 3, 4, 5, 6, and 7}. The program must have the following methods:

1) void displayOddPositions ()

This method displays array elements in the odd positions only, named as, 2, 4, 6.

2) void displayReverse ()

This function shows the array elements in the reverse order so the last item emerges first and vice versa.

3) void multiplyByFactor (int factor)

This method multiplies all the elements within the array by a given factor.

4) void addArray(int[] givenArray)

This method is utilized to add an array to the current data field intArray. First, check that the givenArray is same length as the data field array. If they are the same length, then add each element within the givenArray to the corresponding element in intArray.

5) Write down the main method in order to test and display the functionality of the above methods.

Reference no: EM1321481

Questions Cloud

Questions based on the test for population mean : The Dean of Students believes that the costs are greater this semester. What is the test value for this hypothesis?
Most insignificant office that was the invention of man : John Adams wrote his wife that his office is the "most insignificant office that was the invention of man."
Knowledge of age score account for in competence scores : How much variation does knowledge of Age Score account for in Competence Scores?
Probability of two mutually exclusive events : Probability of two mutually exclusive events intersecting Can be any value between 0 to 1, Must always be equal to 1.
Java program to declare an integer array and initializing it : Write down a complete Java program that declares an integer array, intArray, and initialize it to {1, 2, 3, 4, 5, 6, and 7}. The program must have the following methods:1) void displayOddPositions (). This method displays array elements in the odd..
Assume that the central bank of an economy : Assume that the central bank of an economy contracts the money supply.
Calculate the test statistic value for population mean : A sample of 81 business managers on the West Coast had an average breakfast cost of $7.65. 13. At a = 0.05, what is the test value?
Components of the hawthorne study : Describe how the components of the Hawthorne study are incorporated in current human resource functions? What was the main idea behind this study?
What two variables have the strongest positive strength : What two variables have the strongest positive strength of relationship?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Write a non-recursive version of the process fibonacci

Write a non-recursive version of the process Fibonacci

  Code for addition of new product and delete existing code

Implement the AJAX Programming based solutions in order to write a code to: 1) Add a new product to database. 2) Delete an existing product from database

  Convert csv file into html file

Convert CSV file into HTML file

  Tools that help in the attack

When initially collecting the information on a network, that reconnaissance tool or method do you believe would generate the best results include what information could you learn utilizing this tool or method and how could this information be used..

  Create a program that displays all of numbers in the file

Create a program that displays all of numbers in the file

  Advantages of frame delay-atm-ethernet mans

On the basis of the current offerings for frame delay, ATM, and Ethernet MANs, explain the relative advantages of each.

  Program declaring an integer variable

Write down a complete program that declares an integer variable, reads a value from keyboard into that variable.

  Implementing the code

Write down a program which utilizes a structure named MovieData in order to store the following information about the movieInvolve a constructor which allows all four of these member data values to be specified at the time a MovieData variable is g..

  Factors in selecting suitable data type

Explain the factors in selecting the suitable data type for some value? Which of these is most significant?

  Describe the term tco

Describe the term TCO

  What security measures required to address vulnerabilities

What security measures required to address vulnerabilities Illustrate threats and vulnerabilities that are possible after implementing "big data" technologies in online auctioning company.

  Determining the missing side of triangle

Write down a program which will figure out the missing side of the right triangle utilizing the Pythagorean Theorem. Suppose that the user entries will make a triangle.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd