Answered step by step
Verified Expert Solution
Question
1 Approved Answer
involves coding and testing of a program that focuses on using control structures to allow the user to provide information for a fictional car rental
involves coding and testing of a program that focuses on using control structures to allow the user to provide information for a fictional car rental agency and provide a report related to the amount each customer owes.
- The program will compute and display information for a company that rents vehicles to its customers. For a specified customer, the program will compute and display the amount of money charged for that customers vehicle rental.
- The program will repeatedly prompt the user to enter the following four items for a given customer (in the specified order):
- The customer's classification code (a character)
- The number of days the vehicle was rented (an integer)
- The vehicle's odometer reading at the start of the rental period (an integer)
- The vehicle's odometer reading at the end of the rental period (an integer)
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.
- 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 kilometers driven. The program will recognize both upper case and lower case letters for the classification codes.
Code 'B' (budget)
- base charge: $20.00 for each day
- mileage charge: $0.15 for each kilometer driven
Code 'D' (daily)
- base charge: $30.00 for each day
- mileage charge: no charge if the average number of kilometers driven per day is 150 kilometers or less; otherwise, $0.15 for each kilometer driven above the 150 kilometer per day limit.
Code 'W' (weekly)
- base charge: $190.00 for each week (or fraction of a week)
- mileage charge: no charge if the average number of kilometers driven per week is 900 kilometers or less; $100.00 per week if the average number of kilometers driven per week exceeds 900 kilometers but does not exceed 1500 kilometers; otherwise, the weekly surcharge is $200.00 plus $0.15 for each kilometer driven above the 1500 kilometer per week limit.
The amount billed to the customer is the sum of the base charge and the mileage charge.
- The program will compute the number of kilometers driven by the customer during the rental period. The odometer readings are taken from an odometer that has six digits.
- For each customer, the program will display a summary with the following information:
- The customer's classification code
- The number of days the vehicle was rented
- The vehicle's odometer reading at the start of the rental period
- The vehicle's odometer reading at the end of the rental period
- The number of kilometres driven during the rental period
- The amount of money billed to the customer for the rental period
All output will be appropriately labelled and formatted. The number of kilometers driven is an integer. The amount of money billed will be displayed with a dollar sign and will be rounded to two fractional digits (for example, $125.99 or $43.87).
- The program will detect, report and recover from invalid classification codes. When an invalid classification code is detected, the program will display an error message. It will stop the program. If previous calculations based on correct info have not been shown, they should all be displayed now.
- The program will assume that all other user inputs are valid and correct. That is, the program will not check the number of days or odometer readings for validity.
in python 3 btw
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started