$24
Review Exercises: 3 points each. Starting on page 501, and 543 of textbook Big Java. Place your answers in
ReviewExercises.txt located in the root of this project.
R10.5 Events
R10.6 actionPerformed
R10.11 Inner class and event-listeners
R10.14 Object hierarchies
R10.22 Graphic methods
R11.2 Layout managers
R11.11 ButtonGroup
R11.19 Types of Events
R11.20 Events
R11.21 ActionListener versus MouseListener
Programming Exercises: Name your packages according to the Programming Exercise identifier, except
replace the period with underscore. You will want a Driver class (with a static main() method) to drive your program.
10 points each
P10.9 Italian flag
P10.10 Olympic rings
15 points each
P10.19 Restaurant bill
P11.9 Circle with clicks
The Dice game of Pig: Name your package pig and place all related files in this package.
20 points
Create a Swing application for a simple dice game called Pig. The user will play against the computer.
On a turn, a player rolls the die repeatedly until either:
A 1 is rolled
The player chooses to hold (stop rolling)
If a 1 is rolled, that player's turn ends and no points are earned.
If the player chooses to hold, all of the points rolled during that turn are added to his or her score.
Scoring Examples
Example 1: User rolls a 3 and decides to continue. He then chooses to roll seven more times (6, 6, 6, 4, 5, 6, 1).
Because he rolled a 1, the user's turn ends and he earns 0 points.
Example 2: The computer rolls a random number of times before holding. For example, the computer rolls 5 times.
(6, 3, 4, 2, 6) and then holds. The computer accumulates 21 points (6+3+4+2+6=21).
Game play is returned to the user, who must roll as least once, and so on.
Game End
When a player reaches a total of 100 or more points, the game ends and that player is the winner.
For a more detailed description of the game, see: http://en.wikipedia.org/wiki/Pig_(dice_game)