forked from Hwarner60/ICS-372-Group-Project-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriver.java
More file actions
35 lines (30 loc) · 1.04 KB
/
Copy pathDriver.java
File metadata and controls
35 lines (30 loc) · 1.04 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
//Ethan Willingham
//September 1st, 2022
//ICS 372
//TEST_FILE
import java.util.*;
import java.io.*;
import java.lang.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class Driver {
public static void helloWorld() {
//This method uses System Time to print out a greeting to the user.
String systemTime = String.valueOf(java.time.Clock.systemDefaultZone().instant());
String time = systemTime.substring(11, systemTime.length() - 11);
if (time.charAt(0) >= 0 && time.charAt(0) <= 11) {
System.out.println("Good Morning, World!");
} else if (time.charAt(0) >= 12 && time.charAt(0) <= 17) {
System.out.println("Good Afternoon, World!");
} else if (time.charAt(0) >= 18 && time.charAt(0) <= 23) {
System.out.println("Good Evening, World!");
}
else {
System.out.println("Good Night, World!");
}
}
//Main method
public static void main(String[] args) {
helloWorld();
}
}