Question: Write a method named Copied that two integer parameters named range and b and returns an integer array. The method should return an integer array
- Write a method named Copied that two integer parameters named range and b and returns an integer array.
- The method should return an integer array that has the numbers 0 to range repeated (in order) n times
- Create a second method named printA that takes an integer array as a parameter. The method should print out every element on the same line separated by spaces and place the cursor on the next line after printing all the elements. Use this method to print out the arrays from the main method so that you can verify whether your Copied method is correct.
Sample:
Input
int[] a1 = repeatedN(4, 2);
Output
{ 0, 1, 2, 3, 4, 0, 1, 2, 3, 4 }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
