-
Notifications
You must be signed in to change notification settings - Fork 0
/
DiceDoubles.java
55 lines (41 loc) · 1.07 KB
/
DiceDoubles.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
46
47
48
49
50
51
52
53
54
55
import java.util.Random;
public class DiceDoubles {
public static void main(String[]args)
{
Random rand = new Random();
int type = 1 + rand.nextInt(6);
int frnum;
int choice = 1 + rand.nextInt(6);
int srnum;
int sum;
System.out.println("HERE COMES THE DICE!\n");
while(type < 6)
{
if(type == 1)
frnum = 2;
else if(type == 2)
frnum = 4;
else if(type == 3)
frnum = 5;
else if(type == 4)
frnum = 1;
else
frnum = 6;
type++;
System.out.println("Roll #1: " + frnum);
if(choice == 1)
srnum = 4;
else if (choice == 2)
srnum = 3;
else if (choice == 3)
srnum = 1;
else if(choice== 4)
srnum = 5;
else
srnum = 6;
System.out.println("Roll #2: " + srnum + "");
sum = frnum + srnum;
System.out.println("The total is " + sum + "\n");
}
}
}