Question: Lab Activity 1 Convert to seconds Create a new class calledConvertToSeconds and define it as follows: 1. Edit the top commentsection to describe the
Lab Activity 1 – Convert to seconds Create a new class calledConvertToSeconds and define it as follows: 1. Edit the top commentsection to describe the class and add both of your names asauthors. Include a static main method. 2. Within the main method,declare local variables to store hours, minutes, and seconds. 3.Include a statement(s) to prompt the user to enter three integersfor hours, minutes, and seconds. 4. Calculate and display the totaltime in seconds for hours, minutes, and seconds. Sample OutputEnter hours: 1 Enter minutes: 6 Enter seconds: 6 This is equivalentto 3966 seconds.--------------------------------------------------------------
Lab Activity 2 – Convert from seconds Create a new class calledConvertFromSeconds and define it as follows: 1. Include a staticmain method. 2. Within the main method, declare local variables tostore timeInSeconds, hours, minutes, and seconds. 3. Include codeto prompt the user and scan from input the total time in seconds.4. Break down the total time in seconds into hours, minutes, andseconds. Refer to section 2.5 about integer division and theremainder operator. hours = total / (60 * 60); total = total % (60* 60); Sample Output Enter seconds: 20000 Time for 20000 seconds is5 hours, 33 minutes and 20 seconds.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
