Write a dice game similar to ‘craps’ played in many casinos. In this version your program must do the following: 1.Prompt the user for their name and set their ‘bank’ to $ XXXXXXXXXXStore their name...


Write a dice game similar to ‘craps’ played in many casinos.


In this version your program must do the following:

1.Prompt the user for their name and set their ‘bank’ to $100.00. Store their name and initial bank amount in a Player object. 2.Play 3 games of ‘craps’ by doing the following:a.Prompt the user for a bet – can be any number > 0 (even greater then the amount they have in the bank). If the number is negative re-prompt the user for a positive bet amount.b.Prompt the user for a ‘point’ to bet on. A ‘point’ can be a number from 2-12 but NOT 2, 7, 11 or 12. c.Roll 2 die, a.if they add up to the user point bet then the user wins, declare the user a winner and add their bet amount to their ‘bank’b.If they add up to 2, 7, 11 or 12 then the user looses, declare the user looser and deduct the bet from their bank.c.Otherwise roll again until there is a winner or looser




3.After 3 complete games of ‘craps’ end the program and display the user total wins and total losses and bank amount


Note: the 2 classes required in the UML diagram (see later in these directions) and make then internal static classes





Object Oriented Craps game Object Oriented Craps Game Write a dice game similar to ‘craps’ played in many casinos. In this version your program must do the following: Prompt the user for their name and set their ‘bank’ to $100.00. Store their name and initial bank amount in a Player object. Play 3 games of ‘craps’ by doing the following: Prompt the user for a bet – can be any number > 0 (even greater then the amount they have in the bank). If the number is negative re-prompt the user for a positive bet amount. Prompt the user for a ‘point’ to bet on. A ‘point’ can be a number from 2-12 but NOT 2, 7, 11 or 12. Roll 2 die, if they add up to the user point bet then the user wins, declare the user a winner and add their bet amount to their ‘bank’ If they add up to 2, 7, 11 or 12 then the user looses, declare the user looser and deduct the bet from their bank. Otherwise roll again until there is a winner or looser After 3 complete games of ‘craps’ end the program and display the user total wins and total losses and bank amount Note: not the official Las Vegas rules use these simplified rules instead Note: the 2 classes required in the UML diagram (see later in these directions) and make then internal static classes Object Oriented Craps game sample output 1. Prompt the user for their name and then sent their ‘bank’ to $100.00. You will play 3 games. 2. Prompt the user for a bet – can be any number > 0 (even greater then the amount they have in the bank). If the number is negative re-prompt the user for a positive bet amount. Next prompt user for a ‘bet’ which can be any number > 0 2.B Prompt the user for a ‘point’ to bet one. A ‘point’ can be a number from 2-12 but NOT 2 or 7 OR 11 or 12. Roll until winner or looser. Here rolled an 5 on first try ... So won on first roll. Show both D1 and D2 and Total Bank Have 1 win and 0 loss and $25 is added to user bank Start round 2 Game 2 starts User bets $30 Enters point is 12 but that is not a valid point Ask again … Now enters 8 Player rolls a 7 total on first roll and looses 1 Win and 1 loss … Bank is now $95 Starting game 3 Game 3 starts User bets $100 Enters point is 9 Player rolls a 10 total on first roll so must reroll On second roll, user rolls as 12 .. That’s a loss 1 Win and 2 loss … Bank is now $-5 Final 3 game totals Player - String name; - int bank; - int wins; - int loss + getName() : String + setName(String) :void + getBank() : int + setName(int) :void + getWins() : int + setWins(int) :void + getLoss() : int + setLoss(int) :void Craps - int d1 - int d2; - int point; - String gameState; + Craps(int point) + setName(String) :void– do not need this ? + getBank() : int + roll() :void + getD1() : int + setD1(int) :void + getD2() : int + setD2(int) :void + Player(String name, int bank) Note: roll() would set gameState to either ‘Win’ ‘Loss’ or ‘ReRoll’ Use the following classes in your design. We will cover how to read these in class + getGameState(): String The dash means private the + means it is public Get game state // it is rolling two dice and restate in gnad putting all of the output not in the class game state is re roll Roll resets game state Prompt user for user-name, gather it and then put it in the class No setters in version two because users can then cheat Just getters Do we need the setters on 5 Grading Rubric Submit exactly 2 files (Not a zip) that contains your all your code (The .java file) AND 1 screen shot showing it working! Main method should no more than 30 line He dos have a while loop Variable need to be named well Boolean game – true REMEMBER CAMELCASE AND THAT THE CODE IT CLEAN Use sub ,ethods Constansts change 100 chould be a constanst 6

Mar 27, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here