Class RouletteGame

java.lang.Object
  extended by RouletteGame

public class RouletteGame
extends java.lang.Object

Class that simulates betting on a roulette wheel.

Version:
2/4/12
Author:
Dave Reed

Constructor Summary
RouletteGame()
          Constructor of objects of class RouletteGame.
 
Method Summary
 void addCredits(int numCredits)
          Adds a number of credits to the player's account (assuming the number is positive).
 int checkCredits()
          Determines the current number of credits in the player's account.
 java.lang.String makeBet(int betAmount, java.lang.String betType)
          Makes a bet and simulates the spin, updating the credits accordingly (1-to-1 payoff for color or parity, 35-to-1 payoff for a specific number).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RouletteGame

public RouletteGame()
Constructor of objects of class RouletteGame.

Method Detail

addCredits

public void addCredits(int numCredits)
Adds a number of credits to the player's account (assuming the number is positive).

Parameters:
numCredits - the number of credits to add

checkCredits

public int checkCredits()
Determines the current number of credits in the player's account.

Returns:
the number of credits

makeBet

public java.lang.String makeBet(int betAmount,
                                java.lang.String betType)
Makes a bet and simulates the spin, updating the credits accordingly (1-to-1 payoff for color or parity, 35-to-1 payoff for a specific number).

Parameters:
betAmount - the number of credits being bet
betType - the type of bet ("red", "black", "odd", "even", or "1"..."36")
Returns:
a message that displays the relevant spin value followed by the bet result, e.g., "red - winner", "odd - loser", "15 - loser". If the bet amount is illegal (<= 0 or > credits) then it should return "ILLEGAL BET"