CPSC 120 -- Assignment #2: Skee Ball
Due Friday, October 9, 2009 by 4 p.m.

Write a program that simulates skee ball, a carnival game that consists of rolling balls up a ramp into rings for various points. Begin by creating a java file with the appropriate classes and methods to create and display a window. The window should contain a drawing of three skee ball rings, as illustrated in the image above. Each ring should be labeled with the points received when the ball lands in the ring. Next, draw an X at a random location in the window to simulate where a ball lands. This will require generating random numbers for the x and y coordinates of the ball's landing location in the window. The random x and y coordinates should not exceed the window dimensions. Use the Graphics method drawLine to draw the X such that the two lines of the X intersect at the x and y coordinates of the landing location. Finally, draw the score that is represented by the X in the window appropriately labeled. To calculate the score you must determine which ring the ball landed in. This involves calculating the distance from the the center of a ring to the center of the X. You can calculate this using the Pythagorean theorem, √((x2-x1)2+(y2-y 1)2).

Other Requirements

As usual, use good programming techniques. You should use good variable names, constants where appropriate, whitespace, and correct indentation and alignment of statements. Be sure to put your name, the file name, and a description of the program in the header. The program should be broken up into logical sections and each section should be documented with a brief description of what it does. A program that does not compile earns at most 20% of the assignment grade.

Academic Integrity Reminder!!! Programming assignments are to be your own work. You may get help on the specifics of the assignment from no one except the instructor. You may not show your program to anyone or look at anyone else's program or share ideas with anyone about how to write the program or solve the problem.

Hand In

Turn in a printed copy of your program (the source code) and email the java file to your instructor. Be sure the subject line says cpsc120 assign2.