Question
How do I fill in this code? import sys ''' Section 1: Collect customer input ''' ##1) Request Rental code: #Prompt --> (B)udget, (D)aily, or
How do I fill in this code?
import sys
'''
Section 1: Collect customer input
'''
##1) Request Rental code:
#Prompt --> "(B)udget, (D)aily, or (W)eekly rental?"
#rentalCode = ?
rentalCode = input('('(B)udget, (D)aily, or (W)eekly rental? ')
if rentalCode == 'B' or rentalCode == 'D':
rentalPeriod = int(raw_input('number of Days Rented: '))
else:
rentalPeriod = int(raw_input('Number of Weeks Rented: '))
daysRented = rentalPeriod
#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:
Collect Customer Data - Part 1
Add code to print the rentalCode and rentalPeriod variables to check your work.
Customer Data Check 1A
Check It!
LAST RUN on 2/11/2018 11:22:40 PM
Check 1 failed
Output:
File "rental_car.py", line 9 rentalCode = input('('(B)udget, (D)aily, or (W)eekly rental? ') ^ SyntaxError: invalid syntax
Expected:
(B)udget, (D)aily, or (W)eekly rental? Number of Days Rented: B 3
Customer Data Check 1B
Check It!
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 = ?
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