Question: Write a program that adds two time periods. Both time periods are expressed in hours, minutes and seconds and the resulting sum should also be

 Write a program that adds two time periods. Both time periods

Write a program that adds two time periods. Both time periods are expressed in hours, minutes and seconds and the resulting sum should also be expressed in hours, minutes and seconds. Given the following initial values: hours1 = 5 minutes 1 = 32 seconds1 = 43 hours 2 = 6 minutes 2 = 45 seconds2 = 29 the program should produce the following output: 5 hours 32 minutes and 43 seconds added to 6 hours 45 minutes and 29 seconds is equal to 12 hours 18 minutes and 12 seconds Please note the following: Do not include the above variable initialization statements in your code. They will be provided for you with each CodeRunner test case. You can assume all 6 variables will always be assigned integer values. You need to use the modulus (%) and floor division (/) operators in your calculations. For example: Test Result hours1 = 5 5 hours 32 minutes and 43 seconds minutes1 = 32 added to seconds1 = 43 6 hours 45 minutes and 29 seconds hours2 = 6 is equal to minutes2 = 45 12 hours 18 minutes and 12 seconds seconds 2 = 29 hours1 = 13 13 hours 41 minutes and 6 seconds minutes1 = 41 added to seconds1 = 6 8 hours 57 minutes and 4 seconds hours2 = 8 is equal to minutes2 = 57 22 hours 38 minutes and 10 seconds seconds 2 = 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!