A method that will return a random number based upon the number of sides your die has

computer science

Description

Dice Game

 

You will need to create a class called Dice.  You will need the following items in your Dice class

·         A default constructor

o   That sets the sides of the die to 6

·         A constructor that accepts the number of sides on your die

·         A method that will return a random number based upon the number of sides your die has

·         A method that allows you to change the number of sides on the die

You will create a Dice Game that has the following specifications and rules

·         The user will be rolling 2 dice

o   You will need to create 2 objects from the Dice class

·         The user will enter the amount of money they will be starting the game with

·         The user will enter the amount they wish to bid on their roll

·         The user will roll the 2 die

o   If the die each have the same the number the user will double their bid and add it to their starting amount

o   If the dice total is 7 or 11 the user will double their bid and add it to their starting amount

o   If neither above occur the user will lose the amount they bid from the starting value

·         If the user still has money remaining in the account the computer will ask if they want to play again

o   If they enter yes – start the above steps over again

o   If the enter no – thank the user for playing the game and let them know the amount the ending the game with and the number of times they rolled the dice.

 

·         If the user loses all their money give them a message that they are busted and the total number of times they rolled the dice.

Instruction Files

Related Questions in computer science category