{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CSE 114 - HW 4 - CSE 114 HW 4 CSE 114 Spring 2010 Computer...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 114 - HW 4 http://www.cs.sunysb.edu/~cse114/hw/HW4.html[4/13/2010 5:18:35 PM] CSE 114 - Spring 2010 Computer Science I Home Syllabus Schedule HW 4 - Betting on Dice Rolling In this assignment you will make a dice rolling game. In so doing, you will have to define code inside three different classes: Gambler - used to represent a gambler/player for the game Casino - used to represent the casino account for the game DiceOddsGame - the actual application, it will have a main method, which makes this what we sometimes call a driver class Gambler Define a Gambler class with complete information hiding that will be used to represent a gambler in a casino. This player should have the following properties: Every gambler must have a name, which once assigned, cannot be changed. Every time your program asks the gambler a question, use their name. Every gambler should have their own account balance in dollars. Accounts can start as low as $10 and as high as $100,000, as well as anywhere in between. The money inside the gambler's account can be changed according to how well he/she is playing. The account balance can never go below $0. This class should also provide a means for getting information on how well he/she has played overall. Specifically, it should calculate the percentage increase or decrease in winnings from when he/she started playing. For example, if my original balance was $1000, and now I have $1100, it should give me ($1100 - $1000)/$1000 = 10%. Or, if I originally had $1000, and now I have $900, it shold give me ($900 - $1000)/$1000 = -10%. You may name this method as you like, but make sure to make it descriptive. Finally, the class should provide a means for summarizing the current status of the gambler using a toString method. This should be used after each bet is placed to summarize. This description should include the player's name, his/her current account balance, any percentage increase/decrease in winnings, and a brief commentary depending on whether the player is making money, losing money, or broke. (Don't take this commentary part too seriously, it's just for fun) Casino Define a Casino class with complete information hiding that will be used to represent a casino (i.e., the house). This object should have the following properties: Every casino must have a name, which once assigned, cannot be changed. Everytime you refer to the casino, use the name as held by this object.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon