Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need this written in Python 3.2 and it needs to run and execute in Codio, than

ID: 3732925 • Letter: I

Question

I need this written in Python 3.2 and it needs to run and execute in Codio, thanks

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: 1. Collect customer input 2. Calculate the costs from the customer input 3. 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

Explanation / Answer

# A python code written for rental car cost estimator

# All the instructions provided in the requiremet are taken care of.

# Some test print statements are commented in the code. For testing purpose these can be uncommented.

# Only Rental Summary is getting printed as per requirement.

while True:

try:

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

except ValueError:

print("Please provide a valid value B / D / W?")

#better try again... Return to the start of the loop

continue

else:

if rentalCode!='B' and rentalCode!='D' and rentalCode!='W':

print("Please provide a valid value B / D / W?")

continue

else:

#we're ready to exit the loop.

break

budget_charge = 40.00

daily_charge = 60.00

weekly_charge = 190.00

if rentalCode == 'W':

while True:

try:  

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

except ValueError:

print("Please provide a valid input")

continue

else:

if rentalPeriod == "":

print("Please provide a valid input")

continue

else:

break

else:

while True:

try:  

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

except ValueError:

print("Please provide a valid input")

continue

else:

if rentalPeriod == "":

print("Please provide a valid input")

continue

else:

break

#print("rentalCode = ",rentalCode," and rentalPeriod = ",rentalPeriod)

if rentalCode == 'B':

baseCharge = float(rentalPeriod) * budget_charge

elif rentalCode == 'D':

baseCharge = float(rentalPeriod )* daily_charge

else:

baseCharge = float(rentalPeriod) * weekly_charge

while True:

try:

odoStart = int(input("Starting Odometer Reading: "))

except ValueError:

print("Please provide a valid input")

continue

else:

break

while True:

try:

odoEnd = int(input("Ending Odometer Reading: "))

except ValueError:

print("Please provide a valid input")

continue

else:

break

totalMiles = int(odoEnd) - int(odoStart)

#print("totalMiles = ",totalMiles)

if rentalCode == 'B':

mileCharge = float(totalMiles * 0.25)

elif rentalCode == 'D':

averageDayMiles = float(totalMiles) / float(rentalPeriod)

if averageDayMiles <=100:

extraMiles = 0

else:

extraMiles = averageDayMiles - 100

mileCharge = 0.25 * float(extraMiles) * float(rentalPeriod)

else:

averageWeekMiles = float(totalMiles) / float(rentalPeriod)

if averageWeekMiles >=900:

mileCharge = 100*rentalPeriod

else:

mileCharge = 0

amtDue = float(baseCharge + mileCharge)

print("mileCharge = ",mileCharge)

print("amtDue = ",amtDue)

#Displaying Rental Summary

print(" Rental Summary ")

print("Rental Code: ", rentalCode)

if rentalCode == 'W':

rentalPeriod = print("Weeks Rented: ",rentalPeriod)

else:

print("Days Rented: ",rentalPeriod)

print("Starting Odometer: ", odoStart)

print("Ending Odometer: ", odoEnd)

print("Miles Driven: ", totalMiles)

print("Amount Due: $","{0:.2f}".format(amtDue))

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote