subject

This is java and must follow the instruction and must put //(comment) and make simple program. you1. in this problem, we are going to practice creating, printing, and updating arrays. a. create a class named arraypracticeb. create an instance variable named numbers. it should be an array that holds 20 integers. c. create a constructor that initializes numbers. the heading should look like this public arraypractice(int[] num)d. create a method called printforward. in the method using println print the line: this prints the array forward. this method should then print the array from the beginning (first element) to the end (last element). use print and print a space between each element. use the enhanced for loop to print the array. e. create a method called printbackward. in this method using println, print the line: this prints the line backward. use print and print the array from the end (last element) to the beginning (first element). print all elements on one line with a space between each element. you can use any type loop you want. f. create a method called printodd. in this method using println print the line: this prints the odd index variables, and then use print and print every element at an odd index. you may use anytype loop you want. g. create a method called printeven. in this method using println, print the line: this prints the odd index values and the use print to print every element at an even index. you may use any typeloop you want. print all elements on one line with a space between each element. h. create a method called printfirstandlast. in this method using println, print the line: this prints the first and last elements of the array. print the first element in the array and the last element in the array on one line using print. i. create a method called addone. using a loop, add 1 to each element in the array and then call the method printforward. create a arraypracticetester. k. import java. util. randomprin; l. create an integer array named values. it should hold 20 values. m. create a random number generator by typing. random generator = new random(); n. create a loop – you choose the type. you will fill he array from random numbers generated. your numbers will be between 1 and 100. inside the loop put code to put a random number in the array. use this code: values[i] = 1+ generator. nextint(100); o. after you have filled the array, create an arraypractice object. put the array name in the argument. arraypractice ap=new arraypractice(values); p. call each of the method in the class, arraypractice.

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:00, ziahziah
Which function key is used to enable the spelling & grammar function in a word processing program such as microsoft word?
Answers: 3
image
Computers and Technology, 22.06.2019 10:50, christinavelez26
Using least squares fitting, you are to fit the data sets to the following models and solve for the parameters ai , where i is the index of the parameter. the input/output data for the systems are linked in the bblearn site. for each of the systems use matlab to plot the supplied data vs. the model fit on one plot. include your code in the solutions. (a) linear fit "lineardata. mat" y=a1x^3 + a2x^2 + a3x + a4 (b) plant fit "plantdata. mat g(s) = a1/(s + a2)
Answers: 1
image
Computers and Technology, 22.06.2019 11:00, paigesyring
How does a policy manual an organization? a. it boost productivity. b. it create awareness in employees about the organization’s values. c. it employees achieve targets. d. it safeguards the organization from liabilities.
Answers: 1
image
Computers and Technology, 23.06.2019 02:30, jaueuxsn
Which component acts as a platform on which application software runs
Answers: 2
You know the right answer?
This is java and must follow the instruction and must put //(comment) and make simple program. you...

Questions in other subjects:

Konu
History, 02.09.2019 02:30