Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i get an error with my script and am not sure why since i have averageWeeklyMiles = totalMiles/rentalPeriod ? it says nameError: name 'averageDayMiles' is

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 odoEnd = int(input("Ending Odometer Reading:")) #ask user for milage input print ("(B)udget, (D)aily, or (W)eekly rental?") print ("Number of Days Rented") print ("Starting Odometer Reading:") print ("Ending Odometer Reading:") #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))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

What tools might be helpful?

Answered: 1 week ago