/*LuckySevens.Java
simulates the game of LucySevens until all funds are depleted.
1) Rules:
Roll two dice
if the sum equals 7, win 4$ else lose 1$
2) The inputs are:
the amount of money the user is prepared to lose.
3) Computation:
uses a Dice Class that genertaies a random number
loop until the funds are depleted
count number of rolls
keep track of the Max amount
4) The outputs are:
the number of rolls it takes to deplete the funds
the max amount
*/
import java.util.Scanner;
public class LuckySevens {
public static void main
(String[] args
) { Scanner reader = new Scanner(system.in);
int
dollars, //initail number of dollars (input)
count, //number of rolls to reach depletion
maxDollars, //maximum amount held by the gambler
countAtMax; //count when the maximum is achieved
Dice die1 = new Dice();
Dice die2 = new Dice();
die1.roll();
die2.roll();
// Request the input
System.
out.
print("How many dollars do you have? ");
dollars = reader.nextInt();
// Initalize Variables
maxDollars = dollars;
countAtMax = 0;
count = 0;
//loop until the money is gone
while (dollars > 0) {count++;
private int side;
public Dice()(
side = 1; //set side to any value from 1 - 6)
public int getCurrentSide()( return side;
)
}
}