Answered step by step
Verified Expert Solution
Link Copied!

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-

image text in transcribed
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

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

6-10 What is the purpose of sensitivity analysis?

Answered: 1 week ago

Question

Understand the importance of organizational change.

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago