Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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 LargeList 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 LargeLists 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 Largel ist object. Set the size of the pos array to 3 elements. For the second LargeList 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. DU DD go FT F F % 5 & 7 ( 9 3 4 6 8 8 0 E 20 T YU

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago