develop a class called ConvertSeconds that will contain one main method. • Your main method must do the following: Declare an int variable and assign an integer value representing the number of seconds to the variable. Confirm the number of seconds on the screen. Convert the number of seconds into a combination of hours, minutes, and seconds. Store the results in three separate int variables. Output the results to the screen. • Use constants when possible, such as number of seconds in a minute, and number of seconds in a hour.
develop a class called ConvertSeconds that will contain one main method.
• Your main method must do the following:
Declare an int variable and assign an integer value representing the
number of seconds to the variable.
Confirm the number of seconds on the screen.
Convert the number of seconds into a combination of hours, minutes, and
seconds. Store the results in three separate int variables.
Output the results to the screen.
• Use constants when possible, such as number of seconds in a minute, and number
of seconds in a hour.
The below program is created to demonstrate the conversion of an integer number of seconds into hours, minutes and seconds. It has constants to represent the number of seconds in a minute (60) and an hour (3600). There is a main method which defines an int variable for the total seconds and then calculates and prints the output.
Step by step
Solved in 4 steps with 2 images