-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimeToWork.java
More file actions
24 lines (19 loc) · 867 Bytes
/
TimeToWork.java
File metadata and controls
24 lines (19 loc) · 867 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
package Homework;
public class TimeToWork {
public static void main(String[] args) {
int secInMin = 60;
int minInHour = 60;
int fullTime = 28800;
int sec = (int)(Math.random() * fullTime);
int hour = (sec / secInMin) / minInHour;
System.out.println(sec);
if(hour == 0)
System.out.println("Осталось менее часа");
else if(hour == 1)
System.out.println("Остался " + hour + " час");
else if(hour >= 2 && hour <= 4)
System.out.println("Осталось " + hour + " часа");
else
System.out.println("Осталось " + hour + " часов");
}
}