-
Notifications
You must be signed in to change notification settings - Fork 0
/
Roulette.java
45 lines (33 loc) · 1.11 KB
/
Roulette.java
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
40
41
42
43
44
45
import java.util.*;
public class Roulette{
public Roulette(){
}
public double placebet(double bet){
double winnings= 0;
Scanner scan= new Scanner(System.in);
Random rng= new Random();
int spin=rng.nextInt(37);
System.out.println("Betting options: ");
System.out.println("1 -> Low(1 to 18)\n2-> High(19 to 36) \n3-> Choose a number");
int choice= scan.nextInt();
if (choice == 1 && spin >=1 && spin <=18){
winnings=2*bet;
}
else if (choice == 2 && spin >=19 && spin <=36){
winnings=2*bet;
}
else if(choice==3)
{
System.out.println(" What number would you like?");
int num= scan.nextInt();
if( num== spin){
winnings= 35*bet;
}
else if(choice>3 && choice<3){
System.out.println("No option!");
}
}
System.out.println("Spin: " + spin);
return winnings;
}
}