Question
Rental Summary Calculate the Amount Due. amtDue = baseCharge + mileCharge Print the Customer summary as follows: Rental Summary Rental Code: The rental code Days
Rental Summary
Calculate the Amount Due. amtDue = baseCharge + mileCharge
Print the Customer summary as follows:
Rental Summary Rental Code: The rental code Days Rented: The number of days the vehicle was rented Starting Odometer: The vehicle's odometer reading at the start of the rental period Ending Odometer: The vehicle's odometer reading at the end of the rental period Miles Driven: The number of miles driven during the rental period Amount Due: The amount of money billed displayed with a dollar sign and rounded to two digits. For example, $125.99 or $43.87
Final Check Remove ALL print code from your script, except for the Rental Summary. The following data will be used in this final check:
Rental Code: D Days Rented: 5 Starting Odometer: 1234 Ending Odometer: 2222
Project 1: Rental Car
Introduction
Your task for this project is to create a very simple rental car cost estimator. The project is broken into three sections:
Collect customer input
Calculate the costs from the customer input
Display the results to the customer
Your final output should look like this:
Rental Code: D Rental Period: 5 Starting Odometer: 1234 Ending Odometer: 2222 Miles Driven: 988 Amount Due: $422.00
Request Rental Code. Prompt the user to input the Rental Code.
Prompt: "(B)udget, (D)aily, or (W)eekly rental? " Variable: rentalCode = ?
The code options are:
Code | Category | Rate |
---|---|---|
B | budget | budget_charge = 40.00 |
D | daily | daily_charge = 60.00 |
W | weekly | weekly_charge = 190.00 |
Request number of days or weeks the car was rented.Prompt: "Number of Days Rented: "
OR
Prompt: "Number of Weeks Rented: "
Variable: rentalPeriod = ?
Collect Customer Data - Part 2
if rentalCode == 'B': baseCharge = daysRented * budgetCharge
Set the base charge for the rental type as the variable baseCharge. The base charge is the rental period * the appropriate rate: For example:
Collect Mileage information:
Prompt: "Starting Odometer Reading: "
Variable: odoStart = ?
Prompt: "Ending Odometer Reading: "
Variable: odoEnd = ?
Customer Data Check 2
The following data will be used as input in the test:
rentalCode = 'D' daysRented = 5 odoStart = 1234 odoEnd = 2222
Customer Data Check 2
In your rental_car.py file, add code to print out the two new variables you have collected input for: odoStart odoEnd
And print the calculated variables: baseCharge
Prompt the user to input the starting odometer reading
Prompt the user to input the ending odometer reading
Calculate Charges 1
Step 1: Calculate the mileage.
Calculate the total mileage: ending odometer reading - starting odometer reading and store it as the variable totalMiles The following data will be used as input in the test:
rentalCode = 'D' daysRented = 5 odoStart = 1234 odoEnd = 2222
Calculate Charges 1
Add code to print the value of totalMilesvariable.
alculating Charges 2
Step 2. Calculate the mileage charge Depending on the rental type, the mileage charge is calculated differently. You will need to create add code to calculate the mileage charge for each type of rental. Store the cost of miles drive as the variable mileCharge
Code B (budget) mileage charge: $0.25 for each mile driven
mileCharge = total_miles x 0.25
Code D (daily) mileage charge: no charge if the average number of miles driven per day is 100 miles or less;
mileCharge = .25 x extraMiles x rentalPeriod
Calculate the averageDayMiles = totalMiles/daysRentedIf averageDayMiles is 100 or less,
extraMiles = 0
If averageDayMiles is above the 100 mile per day limit, calculate:
extraMiles = averageDayMiles - 100
Calculate the cost of the extra miles:
extraMiles x $0.25
Code `W` (weekly) mileage charge: no charge if the average number of miles driven per week is 900 miles or less.Calculate the average weekly miles
averageWeekMiles = totalMiles/ weeksRented
If the average number of miles driven per week exceeds 900 miles, the mileCharge is $100.00 per week, otherwise, the mileCharge is $0.00
Calculation Check 2
Calculation Check 2A
Add to your script to print the value of the variable mileCharge for greater than a hundred miles
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