Question: QUESTION Create an application that provides a solution for problem 23.11 by modifying the solution implemented from the BouncingBall.doc file (located in the Project 6/Bouncing
QUESTION
Create an application that provides a solution for problem 23.11 by modifying the solution implemented from the BouncingBall.doc file (located in the "Project 6/Bouncing Ball Original Solution"). The modifications are as follows for the new solution.
Remove the "Runnable" interface from "BouncingBallPanel" class.
Add the "Runnable" interface to "Ball" class
Modify the "mouseClicked" method in the "BouncingBallPanel"class to start the thread after each ball is created. The "Ball" class must receive a reference to the "Bouncing BallPanel" (i.e., to call the "repaint" method)
Remove the "run" method from the "BouncingBallpanel" note. The "run" method must be implemented in the "Ball" class. The inner loop of the "run" method must be removed and the single "move" method call should remain. Also modify the method so that the delay for each ball is different (i.e., a way to simulate ball moving at different rates)
PLEASE CAN I GET THE SAMPLE OUT PUT TO THIS QUESTION.THANK YOU
PROBLEM 23.11
PROBLEM 23.11(Java how to Program (Early Objects) 10th Edition)
23.11 (Bouncing Balls) Modify the program in Exercise 23.10 to add a new ball each time the user clicks the mouse. Provide for a minimum of 20 balls. Randomly choose the color for each new ball.
23.10 (Bouncing Ball) Write a program that bounces a blue ball inside a JPanel. The ball should begin moving with a mousePressed event. When the ball hits the edge of the JPanel, it should bounce off the edge and continue in the opposite direction. The ball should be updated using a Runnable.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
