Question: The project will consist of two Java classes. One class will be named LetsPlayWithArrays. The other class will be named Main and will contain the

The project will consist of two Java classes. One class will be named LetsPlayWithArrays. The other class will be named Main and will contain the main method and create an object from the LetsPlayWithArrays class.
The LetsPlayWithArrays class will consist of the following instance variables and methods:
-array: int[]
+LetsPlayWithArrays()- The constructor method will accept an int parameter named size.
It will initialize the array of int's and pass it to the fillAndCopy() method. The length/size of the array will be determined by the variable size. i.e. if the value passed in for the variable size is 5, the array will have a length of 5.
+fillAndCopy()- The method will fill the array with random values between 0 and 100. Once the array is full, copy all of the values into a new array. Pass the new array to the print() method.
+print()- The method will print all of the values in the array and will also print the total number of values that are divisible by 3. For example, if the array has the following set of values:
3269
the print() method would print the following:
3269
The array has 3 values that are divisible by 3.
The Main class will consist of the following:
It will prompt the User for the size of an array.
It should validate the User's input by ensuring it is not a negative number and not greater than 1000.
If the User's input is valid use it as the size to create a LetsPlayWithArrays object.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!