Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

INSTRUCTIONS: ( 5 0 points ) Individual Problem: To convert from kilometers to miles, you multiply the kilometers by 0 . 6 2 1 3

INSTRUCTIONS:
(50 points) Individual Problem:
To convert from kilometers to miles, you multiply the kilometers by 0.621371. To convert from miles to feet, you multiply the miles by 5280. To convert from feet to yards, divide the feet by 3. This program should input an amount of kilometers and convert it to miles and then to feet and then to yards.
(16 points) Individual Problem #1: Complete a test plan.
Calculate what A., B., C and D will be. Yes, a calculator is perfectly fine to use here. You do not have to give all the labels, just show the 3 numbers in the order miles, feet, yards, showing 3 places for each.
\table[[Description,\table[[Input],[kilometers]],\table[[Expected output],[miles, feet, yards]]],[Normal, integer kilometers,4,A.],[Normal, float kilometers,14.7,B.],[Boundary, zero kilometers,0,C.],[Scientific notation kilometers,3.45e6,D.]]
Put these answers as comments at the bottom of the program you write.
(10 points) Individual Problem #2: Design
# prolog
# GIVE name, section, email address
#Purpose: Calculate the equivalent number of miles, feet and yards from kilometers.
#Preconditions: FILL THIS OUT
#Postconditions: FILL THIS OUT
# 1. Get needed data from the keyboard, the number of kilometers.
# 2. Calculate the equivalent miles.
# 3. Calculate the equivalent number of feet.
# 4. Calculate the equivalent number of yards.
# 5. Print blank line
# 6. Output the input kilometers with label and 3 places.
# 7. Output the miles with label and 3 places.
# 8. Output the yards with label and 3 places.
# 9. Output the feet with label and 3 places.
Make sure you document your program in the .py file with this design. You must have a prolog (name, section, email, purpose, preconditions, postconditions)(see LabO for an example prolog and an example of an entire program).
The Pre-conditions are the input - what type it is and its meaning, and the Post-conditions are the outputs what type they are and their meanings. You need to fill in these lines of the prolog.
(24 points) Individual Problem #3: Implementation
Implement your design in Python. You must include the design given above in your program as comments. Your code statements should appear between the design steps.
Use meaningful variable names!
ALL your code MUST be inside a main function. There is a penalty of 15% if it is not.
Don't forget to put your test case results (Answers for Individual Problem #1 above) at the bottom of the py file.
The output should be formatted exactly like the samples below: (italicized bold text is what the user typed in)
Test run 1
(24 points) Individual Problem #3: Implementation
Implement your design in Python. You must include the design given above in your program as comments. Your code statements should appear between the design steps.
Use meaningful variable names!
ALL your code MUST be inside a main() function. There is a penalty of 15% if it is not.
Don't forget to put your test case results (Answers for Individual Problem #1 above) at the bottom of the py file.
The output should be formatted exactly like the samples below: (italicized bold text is what the user typed in)
Sample Run 1( to the moon )
Enter kilometers: 384400
384400.000 kilometers is 238855.012 miles,
which is 420384821.82 yards or 1261154465.5 feet
Sample Run 2( diameter of earth)
Enter kilometers: 12742
12742.000 kilometers is 7917.589 miles,
which is 13934816.34 yards or 41864449.6 feet
Sample Run 3(marathon )
Enter kilometers: 42.195
42.195 kilometers is26.219 miles,
which is46145.60 yards or138435.0 feet
Sample Run 4
Enter kilometers:
0.006 kilometers is0.008 miles,
which is0.00 yards or0.0 feet
image text in transcribed

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