Question
Conditional Testing ifelse: Write a Java program which asks the user to enter a positive integer. Assume the users input is valid. The program treats
Conditional Testing ifelse: Write a Java program which asks the user to enter a positive integer. Assume the users 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).
-------------------------------------------------------
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started