Write a java program tnat: prompts for and reads a 5-digit number representing a time in...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a java program tnat: prompts for and reads a 5-digit number representing a time in seconds calculates and outputs the corresponding hours, minutes and seconds using the same format as in the sample outputs below. - If the converted hours, minutes and seconds is a valid time (i.e., within the range 00:00:00 to 24:00:00) display the time as hh:mm:ss. Note: if the hours, minutes or seconds are equal to 0, you should display 00. If the converted time is not valid, swap the first and last digits of the original input and output the corresponding hours, minutes and seconds. Use 2 constant variables to store the number of minutes in an hour and the number of seconds in a minute. Following are 4 sample screenshots to illustrate the expected behavior of your program. Assume a perfect user who will always enter a positive integer with 5 digits. Note: Your program must display the same information and formatted the same. Welcome to Time Converter Program Please enter the seconds which will be converted: 86400 The correspond hours, minutes, seconds is 24 hrs, 0 mins, 0 secs. The valid time is: 24:00:00. Thank you for using the Time Converter Program! Write a java program tnat: prompts for and reads a 5-digit number representing a time in seconds calculates and outputs the corresponding hours, minutes and seconds using the same format as in the sample outputs below. - If the converted hours, minutes and seconds is a valid time (i.e., within the range 00:00:00 to 24:00:00) display the time as hh:mm:ss. Note: if the hours, minutes or seconds are equal to 0, you should display 00. If the converted time is not valid, swap the first and last digits of the original input and output the corresponding hours, minutes and seconds. Use 2 constant variables to store the number of minutes in an hour and the number of seconds in a minute. Following are 4 sample screenshots to illustrate the expected behavior of your program. Assume a perfect user who will always enter a positive integer with 5 digits. Note: Your program must display the same information and formatted the same. Welcome to Time Converter Program Please enter the seconds which will be converted: 86400 The correspond hours, minutes, seconds is 24 hrs, 0 mins, 0 secs. The valid time is: 24:00:00. Thank you for using the Time Converter Program!
Expert Answer:
Answer rating: 100% (QA)
Code for the given problem is as folllow import javautil public class Main public static voi... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these algorithms questions
-
Write a java program to compute all prime numbers less than equal to a given integer N using the algorithm "Sieve of Eratosthenes". The Sieve of Eratosthenes is a method used to compute all primes...
-
Write a Java program that simulates car racing, as shown in Figure 16.22(a). The car moves from left to right. When it hits the right end, it restarts from the left and continues the same process....
-
Write a Java program that displays a frame window 300 pixels wide and 200 pixels high with the title My First Frame. Place the frame so that its top left corner is at a position 50 pixels from the...
-
1. 3 2. MONEYBALL MOVIE WORKSHEET 1 1 1 11 6 7 1. Discuss the Oakland Athletics and what is going on with them? How are they look to change? What marketing techniques are being used to better the...
-
Why is error control needed in data communications?
-
If JPJ Corp (the company from the previous question) is able to increase sales by 10% but keep its total and fixed asset growth to only 5%, what will its new asset turnover ratios be?
-
A company wishes to hedge its exposure to a new fuel whose price changes have a 0.6 correlation with gasoline futures price changes. The company will lose $1 million for each 1 cent increase in the...
-
Cook Company estimates that 300,000 direct labor hours will be worked during the coming year, 2014, in the Packaging Department. On this basis, the budgeted manufacturing overhead cost data, shown...
-
Arbon Company has three service departments and two operating departments. Selected data concerning the five departments are presented below: Costs Number of employees Square metres of space occupied...
-
Jackson County Senior Services is a nonprofit organization devoted to providing essential services to seniors who live in their own homes within the Jackson County area. Three services are provided...
-
Jarvene Corporation uses the FIFO method in its process costing system. The following data are for the most recent month of operations in one of the company's processing departments: Units in...
-
The following are selected 2023 transactions of Whispering Winds Corporation. Sept. 1 Purchased inventory from Flint Ltd. on account for $42,800. Whispering Winds uses a periodic inventory system....
-
Choose a country that you might be interested in visiting or studying about and compare its system with the US system. Since this is a short paper, it is very high-level - not much detail. Please...
-
Rabbit populations can double every 30 days. If there are 26 rabbits on a farm, how many rabbits will be on the farm after 240 days? First, complete the equation: Future Amount 26.
-
1) briefly describes the type of person you are, (2) the potential/perceived positive and negative qualities of your personality traits and (3) the three (or more) things you can do to become a...
-
Could you meet these guidelines? White paper outline identifies a problem worth solving, states why it's important and gives at least two recent cases illustrating one successful strategy for solving...
-
Let x be the number of units (in thousands) that a company produces and let p(x) be the profit (in tens of thousands of dollars). The following table gives the profit for different levels of...
-
A report from the college dean indicates that for the previous semester, the grade distribution for the Department of Psychology included 135 As, 158 Bs, 140 Cs, 94 Ds, and 53 Fs. Determine what kind...
-
Create a new class named MyGraph as a subclass of UnweightedGraph that contains a method for finding all connected components in a graph with the following header:public?List>...
-
Write a program that reads a connected graph from a file. The graph is stored in a file using the same format specified in Exercise. Your program should prompt the user to enter the name of the file,...
-
Write a program that compresses a source file into a target file using the Huffman coding method. First use ObjectOutputStream to output the Huffman codes into the target file, and then use...
-
Define human communication.
-
Perceiving your communication as effective while those around you perceive it as ineffective is known as ______________.
-
Visit any of the websites for major social media companies (Facebook, Twitter, LinkedIn, etc.). Under the About Us section, read the company mission statement and goals for the organization. Do you...
Study smarter with the SolutionInn App