CS 1711 Laboratory 2:
The Craps class - using logic in a class


Hand-in Requirements (Deliverables):

Source code: All projects and laboratories will be submitted electronically through Blackboard. Zip up your entire project directory to submit. (Right click on the project folder and follow the SendTo link.)


Craps is a game played with two dice. There are many variations of craps, but the variation that we are going to start with in this laboratory is played as follows:
  • The player rolls the two dice.
  • If the sum of the resulting die values is 7 or 11, the player wins.
  • If the sum is 2, 3, or 12, the player loses.
  • If something else is rolled, the player has to roll again to determine the outcome.
  • If the sum of the second roll is the same as what the player rolled the first time, the player wins. Otherwise the player loses.
  • (You might get a pair of dice and play a few rounds to try it.)
  • Start by creating a new project called lab02. You will be using three classes, Dice, Craps and CrapsTester. All of these classes will be in the games package.

    Part I: Developing and testing the Craps class

    Part II: Completing the Craps class (on your own)

    Part III: Modifying the Craps class to play craps in the standard way.

    In the standard craps game, you still win if you get a 7 or 11 on the first roll. If your first roll is a 2, 3, or 12, you lose. If your first roll is a 4, 5, 6, 8, 9, or 10, you roll again until either you get a 7 (you lose) or you get the number from your first roll.