Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. The program will compute and display information for a company which rentsvehicles to its customers. For a specified customer, the program will compute and

1. The program will compute and display information for a company which rentsvehicles to its customers. For a specified customer, the program will compute and display the amount of money charged for that customers vehicle rental.

2. The program will repeatedly prompt the user to enter the following four items for a given customer (in the specified order):

a. The customer's classification code (a character) b. The number of days the vehicle was rented (an integer) c. The vehicle's odometer reading at the start of the rental period (an integer) d. The vehicle's odometer reading at the end of the rental period (an integer)

3. It will then process that customer information and display the results. It will halt when the user enters Q (or q) instead of a classification code.

4. The program will compute the amount of money that the customer will be billed, based on the customer's classification code, number of days in the rental period, and number of miles driven. And display the total charge

Sample Output

Please enter your full name : Syed Muslim Jameel

Please enter your rental classification code(i.e. B for budget ,D for daily ,and W for weekly):W

How many days did you rent your vehicle for ?21

What was the your vehicle's initial odometer reading(in kms)? 5000

What was the your vehicle's final odometer reading(in kms)?8000

Summary:

Name of vehicle renter : SYED MUSLIM JAMEEL

Number of days vehicle renter :21

Initial odometer reading on renter vehicle:5000kms

final odometer reading on renter vehicle:8000kms

Number of kilometeres driven during rental period:3000

Final of billing cost: $800

Charges Details

Code 'B' (budget) base charge: $40.00 for each day mileage charge: $0.25 for each mile driven

Hint 1:

if classCode == 'B': # For budgeted rental baseCharge = 20 * daysRented kmCharge = 0.30 * kmDriven totalCharge = baseCharge + kmCharge

Code 'D' (daily) base charge: $60.00 for each day

mileage charge: no charge if the average number of miles driven per day is 100 miles or less; otherwise, $0.25 for each mile driven above the 100 mile per day limit.

Hint 2:

elif classCode == 'D': avgKmPerDay = kmDriven / daysRented

driven per day during rental period

 baseCharge = 50 * daysRented if avgKmPerDay <= 100: 
 kmCharge = 0.00 
# Calculation of average Kms 

Code 'W' (weekly) base charge: $190.00 for each week (or fraction of a week) mileage charge: no charge if the average number of miles driven per week is 900 miles

or less; $100.00 per week if the average number of miles driven per week exceeds 900 miles but does not exceed 1500 miles; otherwise, $200.00 per week plus $0.25 for each mile driven above the 1500 mile per week limit.

Hint 3:

elif classCode == 'W': if daysRented <= 7: weeksRented = 1 

Hint 4: # Code for entering wrong class code: else:

print()

print('Sorry {}, but {} is an invalid classification code.'.format(r enterName, classCode))

Write the python program and show the output.

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

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions