forked from team294/Java_Challenge_2023
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.java
More file actions
50 lines (24 loc) · 783 Bytes
/
Copy pathmain.java
File metadata and controls
50 lines (24 loc) · 783 Bytes
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
public class main {
public static void main(String[] args)
{
int count = 1;
//Rolls dice 'count' times and prints out
while (count <= 20) {
//finding random roll
int randomNum = (int)((Math.random() * 6) +1);
System.out.println(count + ": rolling a... " + randomNum + ".");
count++;
}
//calling function to roll die w 5 sides
Die r1 = new Die(5);
//trying to read last roll without rolling first returns -1
System.out.println(Die.readLastRoll());
//Rolling die and printing
System.out.println(r1.roll());
//Reading out last roll
System.out.println(Die.readLastRoll());
//creating a die without stating number of sides creates a die with 6 sides
Die r2 = new Die();
System.out.println(r1.roll());
}
}