Homework Assignment #19 (More Applets)

For this assignment, you'll be creating a Java applet that will run on a web page. You applet should implement a simple game of rock, paper, scissors against a computer opponent. The player of the game must be able to choose "rock", "paper", or "scissors", and when they make their choice, the applet should display the player's choice, the computer's choice, and whether the player won, lost, or tied. The player should now have the option of playing again without reloading the applet. The applet should also display the total number of the player's wins, losses, and ties since they loaded the game. Finally, you should explicitly use of Swing's layout managers to lay out the user interface. You can't just use FlowLayout for the whole thing.

You can choose your own method of input for the player, as long as it's clear how it works. You could simply have three buttons: one for each option. If that's too boring, you could implement a spinner, a combo box (that's the Swing name for a drop-down menu), or a group of radio buttons together with a submit button. Or you could make a menu or a tool bar.

Your computer opponent can use any strategy you want (as long as it doesn't always play exactly the same thing). You can have them play randomly, or it can have a particular strategy that it follows.

If you'd like to, you can implement one of the many variants of rock, paper, scissors instead of the simple version, or even make up your own version.

If you're unfamiliar with the game, you can read the Wikipedia article on it to learn how it's played. It's pretty straightforward.

When you've created the applet and the web page, log on to the class OnCourse page, go to the Assignments tab, and submit your assignment there. Remember to include the URL for your web app (including the port number) with your submission!

This assignment is due Tuesday, July 29th before class.