in Lab6 create two classes: Lab6Array and Lab6Client. Declare and instantiate a
ID: 3589995 • Letter: I
Question
in Lab6 create two classes: Lab6Array and Lab6Client. Declare and instantiate a private integer array called list in Lab6Array that holds 10 places with values: 1,3,4,5,2,6,8,9,2,16.Any help is appreciated. I really just need help getting started but to save time and explain better I added the picture in.
Declare and create (instantiate) a private integer array called list in Lab6Array that holds 10 places that have the values: 1,3,4,5,2,6,8,9,2,16. Write a void method called display which will display the contents of the array (on one line with spaces between each value) In Lab6Client create an object called a of type Lab6Array In Lab6Client call the display method for a Write a void method called displayWithlndex which will display the contents of the array (on separate lines with index, a space, a colon, a space and the value. For example ( 1 Call the method displayWithindex for a in the client Write a void method called changeArrayValue which will have an index and a value and change that index to that value. (a.changeArrayValue(2,-3) would change the value to-3 at index of 2 in a) 7. 8. In client invoke changeArrayValue(4,-888) Display the new contents of a using your method displayWithlndex Write a void method called setArrayWithRandom(int size) which will fill the array with 9 10. 11. 12. 13. 14. 15. 16. 17. 18. random numbers from 1 to size. In Lab6Client create an object called b of type Lab6Array Invoke b.setArrayWithRandom(1000) in the client Display the new contents of b using your method displayWithlndex Write a void method setArrayWithinput which will take user input to set the array. In Lab6Client create an object called c of type Lab6Array Invoke c.setArrayWithlnput in the client Display the contents of the c using your method display Write a void method called setArrayWithlndex which will fill the array with the value of the index (list[0-0 list[1] =1 etc) 19. In Lab6Client create an object called d of type Lab6Array 20. Invoke d.setArrayWithlndex in the client. 21. Invoke d.displayWithlndex in the clientExplanation / Answer
You can create dynamic array in java using ArrayList.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.