CPSC 170 Post Lab 1
A Better Pong
Due Before Class on Friday, January 16th

For this assignment you will make a few additions to the pong program that you created in lab1. Add the following:

Details

If the ball reaches the bottom of the window, stop the animation as normal but also display an option dialog that asks the user if they would like to play again. See the code on page 305 of your book for an example of a dialog box. If the user chooses no, then terminate the application with System.exit(0). If the user chooses yes, then reset the position of the ball and start the animation again.

Add an instance variable to count the number of times the ball bounces off of the rectangle. Update the value whenever the ball intersects with the rectangle and display the value using drawString in the paintComponent method. Remember to reset the value if a new game is started. Add another instance variable that keeps track of the highest number of bounces that has been reached. It should be displayed like the current number of bounces achieved. The instance variable should be updated every time a new high number of bounces is achieved.

Lastly, add something else new to the program, whatever you think would make the program better. Include in your comments for the PongPanel class a description of what you have added.


Hand In: Tar and email your code to your instructor with a subject of cpsc170 postlab2.