Professional Documents
Culture Documents
//COURSE: CST338-30_SU19
//EXERCISE: Mod 2 Casino
import java.util.*;
import java.lang.Math;
//START MAIN
public static void main(String[] args)
{
int bet = 0;
int multiplier = 0;
int winnings = 0;
int numPulls = TripleString.MAX_PULLS;
do
{
//getBet() will prompt the user to enter a value between MIN_BET
//and MAX_BET and return a number between those values.
//Those values are currently MIN_BET 0 and MAX_BET 100
bet = getBet();
numPulls -= 1;
//If the user enters a bet of zero before they exceed MAX_PULLS
//displayWinnings(), otherwise they have reached MAX_PULLS and
//the game displaysWinnings() and ends.
if (numPulls > 0)
{
System.out.print(game.displayWinnings());
}
else
{
System.out.println("\nYou reached the maximum number of 40 pulls!");
System.out.print(game.displayWinnings());
}
keyboard.close();
}
//END MAIN
do
{
System.out.print("How much would you like to bet (1 - " + MAX_BET + ") or "
+ "0 to quit? ");
thisBet = keyboard.nextInt();
}
while(thisBet < MIN_BET || thisBet > MAX_BET);
return thisBet;
}
public static TripleString pull()
// use the randString() method to populate the strings in an instance
// of the TripleString class
{
TripleString pullString = new TripleString();
pullString.setString1(randString());
pullString.setString2(randString());
pullString.setString3(randString());
return pullString;
}
//Default Constructor
TripleString()
{
string1 = "";
string2 = "";
string3 = "";
}
//START accessors
public String getString1()
{
return string1;
}
return gameResults;
}
}
//END TripleString class
/***********************SAMPLE RUN*********************************************
How much would you like to bet (1 - 100) or 0 to quit? 5
******************************************************************************/