Program #4

Extra-credit due date: Friday, March 2, 2:00 pm (for 5 pts extra credit)
"Regular" due date extended to: Monday, March 5, 2:00 pm

Purpose

The objectives for this assignment are to:

Description

You will be writing an applet that responds to input from an HTML and creates poker chips of different values.  The user will have a pile for each color of chips (red blue and green), and there will a pile at the center oject based on this input.  Under each user pile there will a total value of the chips in the pile and a button "ante" to move a chip into the center pile.  There will also be two buttons, "Computer Wins" and "I win".  If the "Computer Wins" button is pushed the coins should be removed from the middle pile and "no longer exist".  If "I win" button is pushed then coins should be moved back to the correct pile (red, blue, or green).    The red chips will have the value 100, blue 500, and the green chips will have a random value between 0 and 1000 (determined using a random number generator).  The number of each type of chip will be read from the HTML file.  See screen shot for example of what the board might look like.

Assignment

Write an Applet that reads parameters from an HTML file. These parameters are the number of blue, red and green chips the player will start out with.  Inside the html file name these parameters "nRedChips", "nBlueChips", "nGreenChips".  Lay out the chips so the user is able to see how many chips they have.  You can imagine looking down at the "table" with the chips on it.  The number of chips should be displayed below each pile, including the middle pile.  Besides each chip having a color it should also have its value written on it.  This will be especially important for the green chips since they do not have a predetermined value.

Implement the buttons as described above.  Determine what both the Pile should know about itself, and the chips.  So, for example, a pile should know how many chips it has in it, and the total value of those chips.  But, since a chip will know its own color, middle pile need not know the color of the chips it is holding.  These things should help you to determine what instance variables each class needs.

A few hints

Details

We will also be looking for the following style types of things in your program (these should be in every program!):

Turn In

Turn in electronically by 2:00pm 3/2/2001: