-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathCAPanique.java
More file actions
119 lines (101 loc) · 3.76 KB
/
CAPanique.java
File metadata and controls
119 lines (101 loc) · 3.76 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import java.util.Scanner;
public class CAPanique {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("\nHey Christian! Wondering what you should do for the day?");
while (true) {
System.out.println("\nEnter the time of day (morning, midday, evening), or type 'exit' to quit: ");
String timeOfDay = scanner.nextLine().toLowerCase();
if (timeOfDay.equals("exit")) {
System.out.println("Goodbye!");
break;
}
switch (timeOfDay) {
case "morning":
morningRoutine();
break;
case "midday":
middayRoutine();
break;
case "evening":
eveningRoutine();
break;
default:
System.out.println("Invalid time of day entered. Please try again.");
}
}
scanner.close();
}
public static void morningRoutine() {
System.out.println("\nMorning Routine:");
freshenUp();
boolean hasSchool = getYesOrNo("Do you have school today? (yes/no): ");
if (hasSchool) {
getReadyForSchool("Math", "Programming");
} else {
enjoyDayOff();
}
}
public static void middayRoutine() {
System.out.println("\nMidday Routine:");
completeTasks("homework", "project");
boolean inSchool = getYesOrNo("Are you currently at school? (yes/no): ");
if (inSchool) {
study("Java programming");
} else {
relax();
}
}
public static void eveningRoutine() {
System.out.println("\nEvening Routine:");
haveDinner("healthy meal");
relax();
doHomework("Java");
}
public static void freshenUp() {
System.out.println("1. Freshen up by brushing your teeth, taking a shower, and having breakfast.");
}
public static boolean getYesOrNo(String message) {
Scanner scanner = new Scanner(System.in);
while (true) {
System.out.print(message);
String input = scanner.nextLine().toLowerCase();
if (input.equals("yes")) {
return true;
} else if (input.equals("no")) {
return false;
} else {
System.out.println("Invalid input. Please enter 'yes' or 'no'.");
}
}
}
public static void getReadyForSchool(String... subjects) {
System.out.print("2. Get ready for school and leave on time. Subjects to study: ");
for (String subject : subjects) {
System.out.print(subject + ", ");
}
System.out.println();
}
public static void enjoyDayOff() {
System.out.println("2. Enjoy your day off! Make sure to relax and have fun!");
}
public static void completeTasks(String... tasks) {
System.out.print("1. Complete tasks: ");
for (String task : tasks) {
System.out.print(task + ", ");
}
System.out.println();
}
public static void study(String subject) {
System.out.println("2. Take time to study " + subject + ". You can never be too sure.");
}
public static void relax() {
System.out.println("2. Take time to relax! Relaxing is also part of a routine. Do something recreational!");
}
public static void haveDinner(String meal) {
System.out.println("1. Have a nutritious dinner with a focus on " + meal + ".");
}
public static void doHomework(String assignments) {
System.out.println("3. Don't forget to do your homework for " + assignments + "!");
}
}