import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.stage.Stage; import java.util.Scanner; import javafx.scene.paint.Color; import static javafx.application.Application.launch; /** * This program generates up to 20 random circles * * @author Dave Slemon * @version v100 */ public class RandomCircles extends Application { /** * Start method (use this instead of main). * * @param stage The FX stage to draw on * @throws Exception */ @Override public void start(Stage stage) throws Exception { Group root = new Group(); Scene scene = new Scene(root); Canvas canvas = new Canvas(400, 300); // Set canvas Size in Pixels stage.setTitle("Random Circle Generator"); // Set window title root.getChildren().add(canvas); stage.setScene(scene); GraphicsContext gc = canvas.getGraphicsContext2D(); // YOUR CODE STARTS HERE Scanner scanner = new Scanner(System.in); int count = 1; System.out.println("This program generates random sized circles.\n"); boolean ok = false; do { System.out.print("How many circles should be generated? (between 1-20) "); count = scanner.nextInt(); scanner.nextLine(); // Consume the newline character left in the buffer ok = (count >= 1 && count <= 20); } while (!ok); Circle c = new Circle(); int num=0; do { c.setRadius(getRandomInteger(10,50)); c.setCenter(getRandomInteger(10,350), getRandomInteger(10,250)); c.setColor(Color.RED, Color.ORANGE); //Color mix = Color.rgb(getRandomInteger(1,250),getRandomInteger(1,250),getRandomInteger(1,250)); //c.setColor(mix,mix); c.draw(gc); num++; } while (num < count); // YOUR CODE STOPS HERE stage.show(); } /** * The actual main method that launches the app. * * @param args unused */ public static void main(String[] args) { launch(args); } //RIGHT HERE YOU NEED TO INCLUDE A METHOD CALLED, getRandomInteger( ) //(get the method in the reusable section of the roadmap }