Question
Codio python Challenge Collect Customer Data - Part 1 Add code to print the rentalCode and rentalPeriod variables to check your work. Customer Data Check
Codio python Challenge
Collect Customer Data - Part 1
Add code to print the rentalCode and rentalPeriod variables to check your work.
Customer Data Check 1A
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 = ?
Test your code.
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 total Miles variable.
Calculating 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
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
import sys
'''
Section 1: Collect customer input
'''
##1) Request Rental code:
#Prompt --> "(B)udget, (D)aily, or (W)eekly rental?"
#rentalCode = ?
#2) Request time period the car was rented.
#Prompt --> "Number of Days Rented:"
#daysRented = ?
# OR
#Prompt --> "Number of Weeks Rented:"
#weeksRented = ?
#CUSTOMER DATA CHECK 1
#ADD CODE HERE TO PRINT:
#rentalCode
#daysRented
#3) Set the base charge for the rental type as the variable baseCharge.
#The base charge is the rental period * the appropriate rate:
budget_charge = 40.00
daily_charge = 60.00
weekly_charge = 190.00
#baseCharge = ?
#4)Collect Mileage information:
#a) Prompt the user to input the starting odometer reading and store it as the variable odoStart
#Prompt -->"Starting Odometer Reading: "
# odoStart = ?
#b) Prompt the user to input the ending odometer reading and store it as the variable odoEnd
#Prompt -->"Ending Odometer Reading:"
# odoEnd = ?
#CUSTOMER DATA CHECK 2
#ADD CODE HERE TO PRINT:
#odoStart
#odoEnd
#baseCharge
'''
Section 2: Calculate the costs from the customer input
'''
#1) Calculate the mileage.
#a) Calculate the total mileage:
# ending odometer reading - starting odometer reading
# and store it as the variable totalMiles
# totalMiles = ?
#2) Calculate the mileage charge and store it as
# the variable mileCharge:
#a) Code 'B' (budget) mileage charge: $0.25 for each mile driven
#b) Code 'D' (daily) mileage charge: no charge if the average
# number of miles driven per day is 100 miles or less;
# i) Calculate the averageDayMiles (totalMiles/daysRented)
# ii) If averageDayMiles is above the 100 mile per day
# limit:
# (1) calculate extraMiles (averageDayMiles - 100)
# (2) mileCharge is the charge for extraMiles,
# $0.25 for each mile
#c) Code 'W' (weekly) mileage charge: no charge if the
# average number of miles driven per week is
# 900 miles or less;
# i) Calculate the averageWeekMiles (totalMiles/ weeksRented)
# ii) mileCharge is $100.00 per week if the average number of miles driven per week exceeds 900 miles
'''
Section 3: Display the results to the customer
'''
#1) Calculate the Amount Due as the variable amtDue
# This is the base charge + mile charge
#2. Display the results of the rental calculation:
#Customer Summary
#Rental Code:
#Days Rented:
#Starting Odometer:
#Ending Odometer:
#Miles Driven:
#Amount Due:
Answer with comments
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