-
Notifications
You must be signed in to change notification settings - Fork 0
/
Roll.java
60 lines (50 loc) · 986 Bytes
/
Roll.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
56
57
58
59
60
import java.util.Random;
public class Roll
{
private Random random = new Random();
private int result; private int stored;
public int d100()
{
result = random.nextInt(100);
return result;
}
public int d20()
{
result = random.nextInt(20);
return result;
}
public int d12()
{
result = random.nextInt(12);
return result;
}
public int d10()
{
result = random.nextInt(10);
return result;
}
public int d8()
{
result = random.nextInt(8);
return result;
}
public int d6()
{
result = random.nextInt(6);
return result;
}
public int d4()
{
result = random.nextInt(4);
return result;
}
public int storedRoll()
{
stored = result;
return stored;
}
public void resultPrint()
{
System.out.println("You rolled a " + storedRoll() + ".");
}
}