-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreversetime.java
More file actions
36 lines (25 loc) · 851 Bytes
/
reversetime.java
File metadata and controls
36 lines (25 loc) · 851 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
25
26
27
28
29
30
31
32
33
34
35
36
import java.util.Scanner;
public class reversetime
{
/* Program that reads values representing a time in seconds then print the
equivalent amount of time as combination of hours, minutes and seconds.
1 minute = 60 seconds
1 hour = 60 minute
60 minute = 3600 seconds
*/
public static void main(String[] args)
{
float hour;
float minutes;
float second;
//int total;
Scanner mySecond = new Scanner(System.in);
System.out.println("Enter Seconds");
second = mySecond.nextInt();
minutes = second/60;
hour = minutes/60;
System.out.println(hour + "hour");
System.out.println(minutes + "minutes");
//System.out.println(second + "seconds");
}
}