-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCrapsDriver.java
More file actions
39 lines (33 loc) · 1.4 KB
/
CrapsDriver.java
File metadata and controls
39 lines (33 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package Practice.Game;
import java.util.Scanner;
public class CrapsDriver {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println(" THE CRAPS GAME ");
System.out.println("REGISTRATION ");
System.out.print("Player name: ");
DiceGame.setName(input.nextLine());
System.out.print("Player age: ");
DiceGame.setAge(input.nextInt());
System.out.printf("%nWelcome %s%nYour account balance is: %,.1fNGN%nMake a deposit to play game%n",
DiceGame.getName(), DiceGame.getBalance());
System.out.print("deposit: ");
DiceGame.deposit(input.nextDouble());
int count = 0;
while (DiceGame.getBalance() == 0) {
System.out.println("Minimum amount deposit-able is 200.");
System.out.println("Try depositing amount above 200.");
System.out.print("\ndeposit: ");
DiceGame.deposit(input.nextDouble());
}
System.out.printf("%nName: %s Age: %d Balance: %,.1fNGN%n",
DiceGame.getName(), DiceGame.getAge(), DiceGame.getBalance());
int i;
for (int a = 0; a<= 3; a++) {
System.out.print("press 1 to play or 0 to exit ");
i = input.nextInt();
if (i == 1) TheCrapsGame.play();
else if (i == 0) System.exit(2);
}
}
}