Homework 4: Time Calculator

Objective: To calculate the number of days, hours, and minutes in a given number of seconds

Write a program that asks the user to enter a number of seconds, then output the equivalent whole numbers of days, hours, and minutes (just the remaining number of each) with remaining number of seconds shown too.

Here is some sample output showing how your program should work:

[cpersiko@fog cs111a]$ javac TimeCalcBetter.java
[cpersiko@fog cs111a]$ java TimeCalcBetter
Enter the number of seconds
30
That equals:
30.0 seconds.
[cpersiko@fog cs111a]$ java TimeCalcBetter
Enter the number of seconds
90
That equals:
1 minutes 30.0 seconds.
[cpersiko@fog cs111a]$ java TimeCalcBetter
Enter the number of seconds
4000
That equals:
1 hours 6 minutes 40.0 seconds.
[cpersiko@fog cs111a]$ java TimeCalcBetter
Enter the number of seconds
90000
That equals:
1 days 1 hours 
[cpersiko@fog cs111a]$ java TimeCalcBetter
Enter the number of seconds
95000
That equals:
1 days 2 hours 23 minutes 20.0 seconds.
[cpersiko@fog cs111a]$ 
When you turn in your program, include your Java code listing and sample output showing several different situations such as above, including at least one example for each category of output (where seconds are largest unit shown, or minutes, or hours, etc.)

Return to CS 111A page