I have add the institutions via pdf. I have also add the Die class for reference. I also inlcude the rules of the game under. The CrapsS17.pdf is the instructions for this assignment.
ITSC 1213 Sections 3
Richard Ilson
Spring 2017
Programming Assignment 1 — Craps Simulation
You are to write a simulation of the Craps dice game. Read the requirements carefully, as I expect you to
implement these requirements, and you will lose points for non-compliance. After you start coding, reread the requirements to make sure you haven’t neglected anything. Post any questions on Piazza.
Use the following rules:
First roll (the “come-out roll”) wins if the total is a 7 or 11. First roll loses if the total is a 2, 3, or 12
(“craps”). If any of these five numbers is rolled on the first roll, tally the win or loss, and the round is
over.
If none of the above is rolled on a first roll, then the value rolled is saved away (i.e., a “point” is
established). You continue rolling the dice until either a 7 or the point is rolled. If the point is rolled
before a 7, tally a win; if a 7 is rolled before the point, tally a loss. Then the round is over.
You’ll keep track of the wins and losses for all rounds played.
You should print rounds exactly as shown on the next page. You should run 100,000 rounds, but only
print the above details for the first 10 rounds. After all 100,000 rounds have run, print out the grand total
of wins and losses.
You’ll use the Die class to simulate the roll of a die. You will want to use the method twice, to simulate
the rolling of two dice. You’ll probably have two loops: one for the rounds, and one when you’re trying to
make the point. (You will use either a flag or logical expression to terminate the inner while loop.) You
will want to enclose the detailed print statements in a conditional (if) statement, and only print the details
if the round inDie.face)
{
answer = 1;
}
else
{
if(face < inDie.face)
{
answer = -1;
}
else
{
answer = 0;
}
}
return answer;
}
}
ITSC 1213 Lab 6
Purpose: To use a class in multiple applications. To write and call static methods.
Part 1: One of the most popular games of chance is a game played with two dice.
The game is called “craps.” As you know, a standard die is a small cube with each
of the six sides displaying a number between 1 and 6. Normally, a number is
represented as a set of spots, so each side will have 1, 2, 3, 4, 5, or 6 spots on it.
Of course, no two sides of a die (honest ones, anyway) have the same number of
spots.
Here are the rules for playing craps:
A player rolls two dice. After the dice come to rest, the sum of the spots on
the two upward faces is calculated.
1. If the sum is 7 or 11 on the first throw, the thrower wins and the
game is over.
2. If the sum is 2, 3, or 12 on the first throw, the thrower loses and the
game is over.
3. If the sum is 4, 5, 6, 8, 9, or 10 on the first throw, then that sum is
known as the thrower's "point".
If the third case occurs, in order to win, the player must keep throwing the
dice until he/she “makes his point,” that is, the sum is equal to his point.
The thrower loses if he throws a 7 before making his point. In either case
(making point or throwing a 7), the game is over.
Write a program that simulates a craps game. Your program should do the
following: Play a game of craps. This requires the use of the Die class you can
download from our Canvas page.
When a game is finished, the program will ask the user if he/she wants to play
another game. The program should either play another game or terminate, based
on the user response.