### Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

# input (“(B)udget, (D)aily, or (W)eekly rental

i get an error with my script and am not sure why since i have averageWeeklyMiles = totalMiles/rentalPeriod ? it says nameError: name ‘averageDayMiles’ is not defined codio@sister-janet:~/workspace\$ Here is my script in Python

import sys

#ask user for input of type of rental

rentalCode = input (“(B)udget, (D)aily, or (W)eekly rental?”)

if rentalCode == “B” or rentalCode == “D”:

rentalPeriod = int(input(“Number of Days Rented: “))

else:

rentalPeriod = int(input(“Number of Weeks Rented: “))

budgetCharge = 40.00

dailyCharge = 60.00

weeklyCharge = 190.00

if rentalCode == “B”:

#calulate charges depending on input from above

baseCharge= rentalPeriod * 40.00

elif rentalCode == “D”:

baseCharge= rentalPeriod * 60.00

else:

baseCharge= rentalPeriod * 190.00

odoStart = (input (“Starting Odometer Reading:”))

#b)   Prompt the user to input the ending odometer reading and store it as the variable odoEnd

print (“(B)udget, (D)aily, or (W)eekly rental?”)

print (“Number of Days Rented”)

#calulate miles driven

totalMiles = int(odoEnd) – int(odoStart)

#calulating of charges based on miles driven and rental type

if rentalCode == “B” :

mileCharge = totalMiles*0.25*rentalPeriod

elif rentalCode == “D”:

averageDayMiles = totalMiles/rentalPeriod

if averageDayMiles <=100 :

extraMiles = 0

else:

extraMiles = float(averageDayMiles – 100)

mileCharge = float(extraMiles*0.25*rentalPeriod)

averageWeeklyMiles = totalMiles/rentalPeriod

if averageWeeklyMiles <=900:

extraMiles = 0

else:

extraMiles = float(totalMiles – 900)

mileCharge = float(extraMiles*100*rentalPeriod)

amtDue = baseCharge + mileCharge

print (“Rental Summary”)

print(“Rental Code:”+ (”  “) +(rentalCode))

print(“RentalPeriod:” + (”  “) +str(rentalPeriod))

print(“Starting Odometer:” + (”  “) +str(odoStart))

print(“Ending Odometer” + (”  “) + str(odoEnd))

print(“Miles Driven:” + (”  “) +str(totalMiles))

print(“Amount Due:” + (”  \$”) +str(amtDue))