import java.util.*;public class Lab8{ // declare global variable "Random_Number" private Random Random_Number; // Create a new random number from Random(long seed) // and store the pointer in global "Random_Number" public static void createRandomWithSeed(long seed) { // Assign a random number from Random(long seed) // with our seed to global "Random_Number" Random Random_Number = new Random(seed); } // Create a random number using Random() constructor public static void createRandom() { // Yeah it really doesn't need to be explained // again. Random Random_Number = new Random(); } // 2% extra credit, finish after the lab is done public static Circle moveTheCircle(int distance) { // Yay, NULL return value! return null; } // Create a new shape of the type named by parameter "shape" public static java.lang.Object newShape(java.lang.String shape) { Circle c; // c Object o; // o Square s; // s Triangle t; // t Cost :-) // Check what input is, depending create new object // and call makeVisible() method. // We can convert the string to lower case to solve one problem shape = shape.toLowerCase(); // Equal to "circle"? if(shape.equals("circle")) { c = new Circle(); c.makeVisible(); c.slowMoveHorizontal(100); o = c; } // How about "square"? else if(shape.equals("square")) { s = new Square(); s.makeVisible(); s.slowMoveHorizontal(100); o = s; } // "triangle"? else if(shape.equals("triangle")) { t = new Triangle(); t.makeVisible(); t.slowMoveHorizontal(100); o = t; } // "circle" it is! else { c = new Circle(); c.makeVisible(); c.slowMoveHorizontal(100); o = c; } // Return shape return o; } public static void main(String[] args) { // Declare my local variables double string_input; String string_quit; long string_save; int done; // I like to initialize all of them string_input = 0; string_save = 0; string_quit = " "; done = 0; // Ask user for input to pass to the random number generators // and then continue if they would like to. while(done == 0) { string_input = IO.readDouble("Please enter a string: "); // If the string is negative 1 pass to createRandom() if(string_input == -1) { createRandom(); } // Else pass to createRandomWithSeed() else { string_save = (long) string_input; createRandomWithSeed(string_save); } // Ask if they want to quit string_quit = IO.readString("Enter 'quit' or your desired shape: "); // Check string_quit = string_quit.toLowerCase(); if(string_quit.equals("quit")) { done = 1; } else { // Call the newShape method with users input newShape(string_quit); } } }}