Beginning with the file that you downloaded named Proj10.java, create the following files:

Proj10RunnerA.java
Proj10RunnerB.java
Proj10X.java
Populate those files with code that meets the specifications given below. The third file in the above list contains an interface definition. The other two files contain class definitions.

Note that you must not modify code in the file named Proj10.java.

Be sure to display your name in the output as indicated.

Note, you will need to save the incoming values to the constructors in instance variables in order to access those values later.

When you place all four files in the same folder, compile them all, and run the file named Proj10.java, the program must display the text shown below on the command line screen.

The output consists of the nine lines of text shown below on the command-line screen.

Because the program generates random data for testing, the actual values will differ from one run to the next unless you enter a command-line parameter. If you would like to get the same random values from one run to the next for testing purposes, enter a command-line parameter such as 5.

In all cases:

1. The values in the first row of three numbers will be a sequence of consecutive integers in increasing algebraic order from left to right. The center value will match the value of randomData shown above that row of numbers.

2. All three values in the second row of three numbers will match the value of the center number in the first row of numbers.

3. All three values in the third row of three numbers will be algebraically five greater than the values in the second row of numbers.

The following should be the output when running the program with an argument of 5:

"I certify that this program is my own work and is not the work of others. I agree not to share my solution with others.

Replace this line with your first name.

Replace this line with your last name.

randomData = 97

96 97 98

97 97 97

102 102 102"

Proj10.java

/*File Proj10.java
The purpose of this assignment is to assess the student's
ability to write programs involving interfaces.

More specifically, the assignment requires the student
to understand and to write programs that require the
following:
Create interface definitions
Implement interfaces in class definitions
Store references to new objects in elements of an
array of type Object
Cast elements to interface types in order to
invoke interface methods
Define interface methods in class definition
Override the toString method
***********************************************************/

// Student must not modify the code in this file. //

import java.util.*;

class Proj10{
public static void main(String[] args){

//Create a random number generator
Random generator = null;
if(args.length != 0){
generator = new Random(Long.parseLong(args[0]));
}else{
generator = new Random(new Date().getTime());
};

//Get a random int value, cast it to type byte, save
// in a variable of type int, and guaratee that the
// value in the variable is positive.
int randomData = (byte)generator.nextInt();
if(randomData < 0){
randomData = -randomData;
}//end if

//Create a two-element array of type Object
Object[] var1 = new Object[2];

//Populate the array with references to new objects
var1[0] = new Proj10RunnerA(randomData);
var1[1] = new Proj10RunnerB(randomData);

//Display four lines of text on the screen.
System.out.println("randomData = " + randomData);

System.out.print(
((Proj10X)var1[0]).getModifiedData() + " ");
System.out.print(randomData + " ");
System.out.println(
((Proj10X)var1[1]).getModifiedData());

System.out.print(((Proj10X)var1[0]).getData() + " ");
System.out.print(randomData + " ");
System.out.println(((Proj10X)var1[1]).getData());

System.out.print(((Proj10X)var1[0]) + " ");
System.out.print(randomData + 5 + " ");
System.out.println(((Proj10X)var1[1]));

}//end main
}//end class Proj10
//End program specifications