-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwillimakeittoschool.java
More file actions
90 lines (81 loc) · 2.92 KB
/
willimakeittoschool.java
File metadata and controls
90 lines (81 loc) · 2.92 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import java.util.*;
public class MyProgram
{
public static void main(String[] args)
{
boolean RunAgain = true;
int version = 0;
while (RunAgain) {
boolean ProgramRunning = true;
version = version + 1;
int percentchance = 0;
Scanner s = new Scanner(System.in);
Scanner t = new Scanner(System.in);
System.out.println("Will I make it to school on time today? Day " + version);
System.out.println("by Liam Kernan");
System.out.println("");
System.out.println("");
System.out.println("How much caffeine consumed? (mg)");
int input1 = s.nextInt();
if (input1 >= 300) {
percentchance += 35;
} else if (input1 >= 200) {
percentchance += 20;
} else if (input1 >= 100) {
percentchance += 10;
}
System.out.println("");
System.out.println("How many hours of sleep?");
int input2 = s.nextInt();
if (input2 >= 8) {
percentchance += 25;
} else if (input2 >= 6) {
percentchance += 10;
}
System.out.println("");
System.out.println("Is there traffic? Type YES, A LITTLE BIT, OR NO ");
String input3 = t.nextLine();
if (input3.equals("NO")) {
percentchance += 30;
} else if (input3.equals("A LITTLE BIT")) {
percentchance += 20;
}
System.out.println("");
System.out.println("");
System.out.println("There is a " + percentchance + "% chance I make it on time");
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("Will I be marked late?");
System.out.println("");
System.out.println("");
System.out.println("If Mr P is not paying attention:");
System.out.println("");
System.out.println("If Mr P is not mad at me:");
System.out.println("");
System.out.println("If Mr P is mad at me:");
System.out.println("");
System.out.println("");
for (double i = 0.5; i <= 1.5; i += 0.5) {
int percentchance2 = (int)(percentchance * i);
if (percentchance2 > 100) {
percentchance2 = 100;
}
System.out.println(percentchance2 + "%");
System.out.println("");
}
System.out.println("");
System.out.println("Would you like to test again? Type YES or NO");
String input4 = t.nextLine();
if (input4.equals("NO")) {
RunAgain = false;
System.out.println("");
System.out.println("Goodbye Mr P. Its been a good one!");
} else {
System.out.println("On to the next day...");
}
System.out.println("");
System.out.println("");
}
}
}