Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with Python Your task for this project is to create a very simple rental car cost estimator. The project is broken into three sections:

Help with Python

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

HERE IS MY CODE. I KEEP GETTING EOFError: EOF when reading a line on several different lines, starting with line 8. Please help:

import sys

rentalCode = input('(B)udget, (D)aily, or (W)eekly rental? ') odoStart = input('Starting Odometer Reading: ')

if rentalCode == 'B' or rentalCode == 'D':

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

else:

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

daysRented = rentalPeriod

budget_charge = 40.00

daily_charge = 60.00

weekly_charge = 190.00

if rentalCode == 'B':

baseCharge = daysRented * budget_charge

elif rentalCode == 'D':

baseCharge = daysRented * daily_charge

elif rentalCode == 'W':

baseCharge = daysRented * weekly_charge

#print(rentalCode)

#print(rentalPeriod)

odoStart = input('Starting Odometer Reading: ')

odoEnd = input('Ending Odometer Reading: ')

totalMiles = int(odoEnd) - int(odoStart)

#print(totalMiles)

if rentalCode == 'B':

mileCharge = 0.25 * totalMiles

averageDayMiles = totalMiles/daysRented

if rentalCode == 'D' and averageDayMiles <= 100:

extraMiles = 0

if averageDayMiles > 100 and rentalCode == 'D':

extraMiles = averageDayMiles - 100

mileCharge = 0.25 * extraMiles * rentalPeriod

weeksRented = rentalPeriod

averageMiles = totalMiles/weeksRented

if rentalCode == 'W' and averageDayMiles > 900:

mileCharge = weeksRented * 100.00

elif rentalCode == 'W' and averageDayMiles <= 900:

mileCharge = 0

amtDue = baseCharge + mileCharge

print('Rental Summary')

print('Rental Code: '+str(rentalCode))

print('Rental Period: '+str(rentalPeriod))

print('Starting Odometer: '+str(odoStart))

print('Ending Odometer: '+str(odoEnd))

print('Miles Driven: '+str(totalMiles))

print('Amount Due: '+'${:,.2f}'.format(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

Step: 3

blur-text-image

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

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

Describe the economic model that is proposed for the operation.

Answered: 1 week ago