Due dates: This lab is for you (individually) to start on now, work on during the week of September 4-11, work on (with help from the TA if needed) during your lab on September 11, then turn in completed at the beginning of lab on September 18.
Demo: You will be expected to demo the running program for the TA at the beginning of lab Monday, September 18. Do not think that you will get a bug or two out of the program before your demo on the morning of lab.
VERY IMPORTANT: For this assignment only, the only methods and
classes from the
Java standard library you may use in your final solutions are:
1. the System.arraycopy method
2. the Math class and any of its methods
3. the Random class and any of its methods
Problem: You are given a Java program, ArrayProblems.java that needs to be modified.
The methods for you to write:
original is equal to the int array {1, 2, 3} there are 6 possible
arrays that could be returned:
Math.random method. This returns a double
uniformly distributed between 0.0 inclusive and 1.0 exclusive. If you
wanted to generate a random number between 0 and 9 inclusive the
following code does the job:int x = (int) ( 10 * Math.random() ); int x = (int)(10 * Math.random() ) + 1 ;int x = (int)(range * Math.random() ) + first_value;
Random class from the Java standard library.
The Random class is the the java.util package so you have
to include the lineimport java.util.Random;
nextInt(int n) method.
Random randNumGen = new Random();
int x = randNumGen.nextInt(range);