forked from ChrisMayfield/ThinkJavaCode2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTime.java
More file actions
20 lines (18 loc) · 658 Bytes
/
Copy pathTime.java
File metadata and controls
20 lines (18 loc) · 658 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public class Time {
public static void main(String[] args) {
int hour, minute,
second, day,
time, remaining;
double percentageDay;
hour = 20;
minute = 23;
second = 30;
day = 24 * 3600; // secs
time = (hour * 3600) + (minute * 60) + second;
remaining = day - time;
percentageDay = time * 100.0 / (day);
System.out.println("Time passed since midnight: " + time + " seconds.");
System.out.println("Time of the day remaing: " + remaining + "seconds.");
System.out.printf("Percentage of the day that has passed: %.2f\n", percentageDay);
}
}