Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

program is pycharm ce Part IV: Determine the Ending Time (25 points) Write a function ending time that determines the final clock time after a

image text in transcribed program is pycharm ce
image text in transcribed
Part IV: Determine the Ending Time (25 points) Write a function ending time that determines the final clock time after a task has been completed. The function takes three arguments that provide the current time of day, as well as the total time in seconds that it will take to complete the task: 1. hour: the current hour of the day (0-23) 2. minute: the current minute of the day (0 - 59) 3. second: the current second of the day (0 - 59) 4. time taken: the number of seconds it will take to complete the task (greater than 0) You may assume that the four input values are always valid. As an example of what this function computes, consider the test case: 2.59, 40, 22. This means that the current hour is 2, the current minute is 59, the current second is 40, and the time to complete the task is 22 seconds. Se the first three function arguments represent the time 2:59:40 am. Adding time taken to the current second value updates the second value to 62. Because 62 seconds is 60 (i.e., at least one minute), the current second value is updated to 2. The ninute value must also be incremented by 1 minute, to 60. Similar to how we handled the second value, the minute is set to zero because we have a whole new hour. Finally, the hour value must be incremented by I because minute rolled over from 5 to 60 and then to 0. This produces the final result of 3.0, and 2 for hour, minute and second, respectively The return value of the function is an f-string given in this format: 'humist, where h gives the updated hour, m gives the updated minute, and a gives the updated second. To keep things simple the returned string should not include leading zeroes. As an example, if the new values for hour, minute and second are 5, 9 and 2, the returned value should simply be the string '5:9:21. not'05:09:02' Answers that contain leading zeroes will be marked as incorrect. Function Arguments Return Value 2, 59, 40, 22 3:0:2' 5, 11, 24, 6 '5:11:30 4, 11, 25, 236 .4:15:21 11, 54, 56, 340 12:0:36 22, 52, 48, 8000 '1:6:8' 17, 17, 5, 31688 '2:5:13' 19, 6, 53, 7500 21:11:53 20, 34, 35, 26770 4:0:45' 19, 54, 3, 15463 0:11:46 18, 21, 35, 26875 1:49:30

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

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions