Class RouletteGame

java.lang.Object
  extended by RouletteGame

public class RouletteGame
extends java.lang.Object

Class that simulates betting on a roulette wheel.

Version:
11/04/09
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, int number)
          Makes a bet on a specific number and simulates the spin.
 java.lang.String makeBet(int betAmount, java.lang.String color)
          Makes a bet on a color and simulates the spin.
 
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,
                                int number)
Makes a bet on a specific number and simulates the spin. If the player wins, they are credited with 35x their bet; otherwise they lose the bet amount.

Parameters:
betAmount - the number of credits being bet
number - the wheel number being bet upon (1-36)
Returns:
"winner" if the player wins, "loser" if they lose, or "ILLEGAL BET" if the bet is illegal

makeBet

public java.lang.String makeBet(int betAmount,
                                java.lang.String color)
Makes a bet on a color and simulates the spin. If the player wins, they are credited with the bet amount; otherwise they lose the bet amount.

Parameters:
betAmount - the number of credits being bet
color - the color being bet upon ("red" or "black")
Returns:
"winner" if the player wins, "loser" if they lose, or "ILLEGAL BET" if the bet is illegal