COMP 14-090 Summer I 2000
Assignment 4: Rock-Paper-Scissors Game
Assigned: Thursday, June 1
Due: Tuesday, June 6
Worth: 80 points
Description
Programming Project 3.11, page 171
Design and implement an application that plays the Rock-Paper-Scissors
game against the computer. When played between two people, each person picks
one of the three optins (usually shown by a hand gesture) at the same time and
a winner is determined. In the game, Rock beats Scissors, Scissors beats
Paper, and Paper beats Rock. The program should randomly choose one of the
three options (without revealing it), then prompt for the user's selection.
At that point the program reveals both choices and prints a statement
indicating if the user won, the computer won, or if it was a tie. Continue
playing until the user chooses to stop; then print the number of user wins,
losses, and ties.
This solution to the problem should be modular . It should
also make use of conditionals, loops, and methods.
What to Turn In
- A printout of your Java source code.
- A disk with your Java source code (RPSGame.java) and bytecode
(RPSGame.class).
- An image of the output window. Make sure you see "==> End of job" before
you capture the image. (You may include the output window image in the same
document as your memo instead of turning in a separate printout of the output
window.)
- A memo describing the problem and your solution of it. Include any
problems you encountered or comments you may have about the assignment. Also,
include an estimate of the total amount of time you spent working on this
assignment.
- Your disk should contain the following files:
- RPSGame.java your Java source code
- RPSGame.class your Java bytecode
Steps to Follow
- Follow the instructions in Getting Started with
Visual J++ under "Creating a New
Project." Use Assignment4 as your project name.
- Follow the instructions under "Adding
a New Class." Name your class RPSGame.
- Use Assignment 3 as a template for starting the code on this
assignment (header comments, main method, etc.)
- Save often!
Notes
- Test your program with various numbers as input. The program should
not crash or report errors when given numerical inputs.
- Don't forget to comment your program! If there are no
comments, you will lose at least 25% of the points.
- Don't forget to virus check and label your disk according to the
instructions in Turning in Assignments on Disk.
- Don't forget to sign the pledge on the printout of your source code.
The following output window is just an example. You don't have to use the
same formatting. To get black text on a white background, I pasted the
captured image into the Paint program and inverted the colors.
Michele Clark
clark@cs.unc.edu