Answered step by step
Verified Expert Solution
Question
1 Approved Answer
plz use Java Consider the following class definition: public class LargeList private int[] pos; public void reset(int[] newPos) { this.pos = new Pos; } 1-
plz use Java
Consider the following class definition: public class LargeList private int[] pos; public void reset(int[] newPos) { this.pos = new Pos; } 1- Create a public constructor that takes one integer named 'number'. Initialize pos to a new integer array of length 'number'. Initialize the contents of the pos array to random integers. Each integer entry should be greater than the previous entry by a small random amount (+1...+10). All array values should be positive. 2- Create a public copy constructor that takes a reference to another Large List object. Perform a deep copy i.e. the new object will use its own position array. 3- Write a public method named equals which returns true only when two Large Lists objects are identical. Write a main method to test the class. Create two Largelist objects. Use the constructor that takes one integer parameter to create the first LargeList object. Set the size of the pos array to 3 elements. For the second Large List pos array, set the size of the pos array elements to 4. Check if the two pos arrays are equal. Create a copy of the first LargeList object using the copy constructor. Check if the two objects are equal. Reset the values of the pos array elements in the copy object to 4, 6 and 7. Check if the copy object is still equal to the original copied LargeList object Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started