Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

2. How were various roles filled?

Answered: 1 week ago