CSCI 180/181 Lab 7

handin name for today's lab is lab7 The lab is due on 4 March 2008 at 23:59. You must use good style and comments, as usual.

Objectives

In class last week, we looked at Random and created a Dice class. For this lab, we will create a game called Greedy Pig. Here are the rules:

  1. The game consists of n players, and requires a fair, six-sided die.
  2. At the start of a round, all players are standing up. The die is rolled; each player gets the number of points on the die.
  3. Each player may keep their points by sitting down, or remain standing for another roll. With each roll, points accumulate for those who choose to remain standing. BUT if a 5 is rolled, then all players still standing lose their points, ending the round with a score of 0.
  4. Game continues with a new round. Number of rounds is chosen by the person running the game.

We are only going to create a single player version of this. You'll need to create a class called GreedyPig (name your project lab7) along with the Dice class. Feel free to enhance this to make it more interesting as long as the above aspects are covered. Use handin to turn in Dice.java and GreedyPig.java under lab7.