Lab Tennis - demo by 10/26
Write a Java Applet that will keep track of, and report, the score during a tennis game; once your Applet is working, post it on your web page.
Your Applet should include a picture for each player.
Read Chapter 7 for useful information.
The same player serves for an entire tennis game. Before each point, the score is announced, server's score first.
A game is won when one of the players has at least four points and is at least two points ahead.
In tennis, scores of zero, one, two, and three, are announced as love, fifteen, thirty and forty. Thus, if the score were
3-0, your Applet should
announce, Forty-Love. Use a TextArea to announce the scores as the game progresses, so you can see the entire game.
If the score reaches 3-3, then, until the game is decided, the score is announced as "deuce" for ties and "advantage server" or "advantage receiver",
depending on who is ahead by one.
Your program should announce the score before each point, as well as the winner of the game. Once the game is over, it should not allow additional points.
Assume for now that the user will push one of two Buttons for each point, one if the server gets the point, the other if the receiver gets the point.
Warning! Set the layout of your Applet to null, or it will *not* load in any browser!!
Posting your Applet to the web
- Create a web page on Willamette's server; follow these instructions
- Post your Applet there; follow these instructions!
- For hints on the above; try these instructions!
Extra credit - each level entails more credit
- Make it play an entire set.
- Make it play an entire match.
- Automate the match so you don't have to push the Buttons (write a loop and award points at random, but let the server have a slight advantage)
- Implement a Monte Carlo simulation of tennis matches. Add a slider to set the likelihood of the server winning each point. Determine what advantage per point
yields a 90% win rate for matches.
- Simulate a single elimination tennis tournament (like the U.S. Open). Assign attributes to individual players (like serve speed, quickness, etc). Simulate
matches based on the attributes of the individuals.