Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

in python code please CptS 111-PA #3 Due Sunday, Feb. 10, 2019 A RUNNING TIME CALCULATOR For this assignment, you must write a single program

image text in transcribed

image text in transcribed

image text in transcribed in python code please

CptS 111-PA #3 Due Sunday, Feb. 10, 2019 A RUNNING TIME CALCULATOR For this assignment, you must write a single program with four functions. You must include a docstring in each function, use comments, and make your program readable by using whites- pace effectively. You will be graded on all these aspects, not just on whether your program runs correctly. You will need to submit your program to Blackboard as a zipped file so if you don't know how to zip a file, ask your TA during your lab or else google how to do it for your operating system. Note that the grading rubric for this PA is available on Blackboard Header information. Your program must include the following information in the header e Name CptS 111, Spring 2019 Programming Assignment #3 . Date . Name of program * Brief description and/or purpose of the program; include sources Program Requirements Your program, call it run.calc.py, must prompt the user for a running pace (time/mile) in standard format (mm: ss) and distance in miles. It must display the time needed to run the distance at the given pace in standard format (hh :mm: ss). The time values should be integers The following examples demonstrate how your program should work. Use them to test your program. Boldface text are what you need to enter i Enter pace [mm: ss] 8:15 1 Enter distance [miles]: 26.2 4 Time needed to run 26.2 miles at a(n) 8:15 pace: 3:36:09 i Enter pace [mm: ss] 6:09 1 Enter distance [miles]: 6.2 4 Time needed to run 6.2 miles at a( 6:09 pace: 0:38:07 The four functions you need to write are . get.input): A non-void function that prompts for the pace and distance and returns 3 values: the pace in standard time (mm: ss) as a string, the pace in seconds per mile as an integer, and the distance as a float. The function has no arguments. (See example below.) calc.time ): A non-void function that returns the total time needed to run the distance in seconds. The function has two arguments: the pace in seconds per mile (an integer) and the distance (a float) * display time ): A void function that displays the time in standard format (hh:mm: 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 information between them Use a divide-and-conquer approach to write your program. Implement each function individually, and make sure it works properly before moving on to the next onde To implement the get.input ) function, you'll have to include the following statement exactly as it's given mm, ss-int (pace.split(':') [0]), int (pace.split(:') [1]) where pace is a string and mm and ss are integers. You'll learn how to write such statements later The last line of your program should be a call to main). Don't forget to use a docstring for each of your functions The following examples show how get.input ),calc.time , anddisplay time ) should work in your IDLE Shell window. These examples are given so you can check each function indi vidually to see whether it's working properly, but you need to write your program in the IDLE Editor window, and the entire program (all the functions together) should work as shown on page 1 when you run 1t. i >>> get_input () Enter pace [mm: ss] 8:15 Enter distance [miles] 26.2 1 >>> pace, sec per mile, dist get_input () s Enter pace [mm: ss] 8:15 6 Enter distance miles] 6.2 7 > print (pace, sec per_mile, dist) 8:15 495 6.2 >>> calc-time (495, 2) # 8:15 pace for two miles 990 , >>> total-time- calc time (495, 3) # 8:15 pace for three miles >print (total_time) 1485 1 >>> display time (9) 2 0:00:09 display time (109) 0:01:49 > display_time (10000) 2:46:40 Submission information. Use Blackboard to submit your program. Subm as a zipped file called -pa3.zip. If you don't know how to zip a file, ask your TA or else google how to do it for your operating system (Windows, Mac OS X, or Linux)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions