Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your program, call it run-calo py, must prompe the user for a running pace (timemile) in standard foeman (n:ss) and distance in miles. It must

image text in transcribed
Your program, call it run-calo py, must prompe the user for a running pace (timemile) in standard foeman (n:ss) and distance in miles. It must display the time needed to nun the distance at the given pace in standand format (hhimmissk. The time values should be imegers. The following examples demonsarate how your program should woek. Use them to est your program Boldface text are what you need to enter Enter pace s: 8:15 Enter distance milesl: 26.2 Tine needed to zun 26.2 m1es at ain) 8:15 pace: 3:36:09 Enter pace ssl: 6:0 i Enter distance ailes: 6.2 Tine needed to run 6.2 niles at a(r) 6:09 pace: 0:38:07 The four functions you noed to write are: . get input A e-void function that peompes for the pace and distance and retuens 3 values: the pace in standard tarne( 155) as a string. the pace in seconds per mile as an inleger, and the distance as a loat. The function has no arguments, (Sce example below e calc.time (): A non-void function that retums the total time meeded to run the distance in seconds. The function has two agumems: the pace in secoeds per mile (an imeger) and the distance (a oat) display tine0:A void function that displays the time in standard formCh:ss The function has a single argument: the time in seconds main(: A void function that begins execution, calling the other functions as appropriate and passing informaticn between them Use a divide-and-conquer appeoach to wrise your program. Implement each function individually.and make sure it works properly before moving on to the next one To implement the get-input function, you'll have to include the following statement esactly as it's given: nn, ss int (pace.split10D. int (pace,split where pace is a string and n and ss are integers. You ll leam how to write such statements later The last line of your program should be a call to main each of your functions Don forget o use a doest ring for The following exampkks show how get-input 0.calctine (), and display.tine shoul work in your IDLE Shell window. These examples are given so you can check cach function indi vidually to see whether it's working properly, ut you meed to write yor program in the IDLE Editor window, and the entire program (all the functions together) should work as shown on page I when you run n get input (O Enter distance Inilesla 26.2 Enter pace Imissl: 8:1 iEnter pace m:1: 8:15 pace, sec per nile, dist- get input ) Enter distance [miles): 6.2 print (pace, sec per mile, dist) 8115 495 6.2 >>> cale-time (495-2) # 8:15 pace for two miles 990 total-time >print (total tine , >>> . calc-time (495, 3) # 8:15 Pace for three miles 1485

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

Intelligent Information And Database Systems 12th Asian Conference ACIIDS 2020 Phuket Thailand March 23 26 2020 Proceedings

Authors: Pawel Sitek ,Marcin Pietranik ,Marek Krotkiewicz ,Chutimet Srinilta

1st Edition

9811533792, 978-9811533792

More Books

Students also viewed these Databases questions