Question: Write a Java program which asks the user to enter a positive integer. Assume the user's input is valid. The program treats this integer as
Write a Java program which asks the user to enter a positive integer. Assume the user's input is valid. The program treats this integer as a length of time in seconds. The program converts this length of time into days, hours, minutes, and seconds, and then outputs the results. There are 60 seconds in each minute, 60 minutes in each hour, and 24 hours in each day. The number of seconds in your output must be less than 60. The number of minutes in your output must also be less than 60, and the number of hours in your output must be less than 24. Here are two sample runs (user input is in bold):
Enter length of time in seconds: 157 That is 0 day(s), 0 hour(s), 2 minute(s), and 37 second(s).
__________________________________________________________________________
Enter length of time in seconds: 309718 That is 3 day(s), 14 hour(s), 1 minute(s), and 58 second(s). __________________________________________________________________________
public static void main(String [] args) {
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
