Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am doing this in Eclipse Java IDE and if possible please write comments omn the code sections explaining what each part does. Thank you!

I am doing this in Eclipse Java IDE and if possible please write comments omn the code sections explaining what each part does. Thank you!
For this assignment you create the game of the CRAPS in ONE file only. (Craps.java)
This program has TWO methods ONLY: main and RollDice.
Create a static method RollDice(). This method rolls two dice and return their sum and
will be called from the main method.
Use ENUMS for the status of the game. Example : enum Status{ CONTINUE, WON,
LOST}
DO NOT use constants (static final variables) in this assignment.
DO NOT use switch statement in this assignment.
Basic rules for the dice game Craps:
You roll two dice.
If the sum is 7 or 11 on the first throw, you win.
If the sum is 2,3 or 12 on the first throw (called "craps"), you lose (i.e., the "house"
wins).
If the sum is 4,5,6,8,9 or 10 on the first throw, that sum becomes your "point." To win,
you must continue rolling the dice until you "make your point" (i.e., roll that same point
value). You lose by rolling a 7 before making your point.
Sample Output:
Player rolled 5+4=9
Point is9
Player rolled 4+2=6
Player rolled 3+6=9
Player wins
Player rolled 2+6=8
Point is8
Player rolled 5+1=6
Player rolled 2+1=3
Player rolled 1+6=7
Player loses
Fig. 6.8| Craps class simulates the dice game craps. (Part 5 of 5.)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions