Question

Introduction Your task for this project is to create a very simple rental car cost estimator....

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: $324.40

_______________________________________

Section 1-1:

import sys
'''
Section 1: Collect customer input
'''

##Collect Customer Data - Part 1

##1)   Request Rental code:
#Prompt --> "(B)udget, (D)aily, or (W)eekly rental?"
#rentalCode = ?

#2)   Request time period the car was rented.

#Prompt --> "Number of Days Rented:"
#rentalPeriod = ?
#   OR
#Prompt --> "Number of Weeks Rented:"
#rentalPeriod = ?

#CUSTOMER DATA CHECK 1
#ADD CODE HERE TO PRINT:
#rentalCode
#rentalPeriod


#Calculation Part 1

##Set the base charge for the rental type as the variable baseCharge.
#The base charge is the rental period * the appropriate rate:

____________________________________________________________________

Section 1-2:

import sys
'''
Section 1: Collect customer input
'''
#Add customer input 1 here, rentalCode = ?

#Collect Customer Data - Part 2

#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:\n"
# odoStart = ?

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

#Prompt -->"Ending Odometer Reading:"
# odoEnd = ?

#c) Calculate total miles

#Print odoStart, odoEnd and totalMiles


# Calculate Charges 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/rentalPeriod)

# 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/ rentalPeriod)

# ii)   mileCharge is $100.00 per week if the average number of miles driven per week exceeds 900 miles

____________________________________________________________________

Section 2-1:

import sys
'''
Section 1: Collect customer input
'''

##Collect Customer Data - Part 1

##1)   Request Rental code:
#Prompt --> "(B)udget, (D)aily, or (W)eekly rental?"
#rentalCode = ?

#2)   Request time period the car was rented.

#Prompt --> "Number of Days Rented:"
#rentalPeriod = ?
#   OR
#Prompt --> "Number of Weeks Rented:"
#rentalPeriod = ?

#CUSTOMER DATA CHECK 1
#ADD CODE HERE TO PRINT:
#rentalCode
#rentalPeriod


#Calculation Part 1

##Set the base charge for the rental type as the variable baseCharge.
#The base charge is the rental period * the appropriate rate:

___________________________________________________________

Section 2-2:

import sys
'''
Section 1: Collect customer input
'''
#Add customer input 1 here, rentalCode = ?

#Collect Customer Data - Part 2

#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:\n"
# odoStart = ?

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

#Prompt -->"Ending Odometer Reading:"
# odoEnd = ?

#c) Calculate total miles

#Print odoStart, odoEnd and totalMiles


# Calculate Charges 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/rentalPeriod)

# 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/ rentalPeriod)

# ii)   mileCharge is $100.00 per week if the average number of miles driven per week exceeds 900 miles

__________________________________________________________________________________________

Section 3-1:

import sys
'''
Section 1: Collect customer input
'''

##Collect Customer Data - Part 1

##1)   Request Rental code:
#Prompt --> "(B)udget, (D)aily, or (W)eekly rental?"
#rentalCode = ?

#2)   Request time period the car was rented.

#Prompt --> "Number of Days Rented:"
#rentalPeriod = ?
#   OR
#Prompt --> "Number of Weeks Rented:"
#rentalPeriod = ?

#CUSTOMER DATA CHECK 1
#ADD CODE HERE TO PRINT:
#rentalCode
#rentalPeriod

#Calculation Part 1

##Set the base charge for the rental type as the variable baseCharge.
#The base charge is the rental period * the appropriate rate:


#Collect Customer Data - Part 2

#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:\n"
# odoStart = ?


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

#Prompt -->"Ending Odometer Reading:"
# odoEnd = ?

#c) Calculate total miles

#Print odoStart, odoEnd and totalMiles


# Calculate Charges 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/rentalPeriod)

# 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/ rentalPeriod)

# ii)   mileCharge is $100.00 per week if the average number of miles driven per week exceeds 900 miles

_____________________________________________________________________________________________

Section 3-2:

import sys
'''
Section 1: Collect customer input
'''

##Collect Customer Data - Part 1

##1)   Request Rental code:
#Prompt --> "(B)udget, (D)aily, or (W)eekly rental?"
#rentalCode = ?

#2)   Request time period the car was rented.

#Prompt --> "Number of Days Rented:"
#rentalPeriod = ?
#   OR
#Prompt --> "Number of Weeks Rented:"
#rentalPeriod = ?

#CUSTOMER DATA CHECK 1
#ADD CODE HERE TO PRINT:
#rentalCode
#rentalPeriod

#Calculation Part 1

##Set the base charge for the rental type as the variable baseCharge.
#The base charge is the rental period * the appropriate rate:


#Collect Customer Data - Part 2

#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:\n"
# odoStart = ?


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

#Prompt -->"Ending Odometer Reading:"
# odoEnd = ?

#c) Calculate total miles

#Print odoStart, odoEnd and totalMiles


# Calculate Charges 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/rentalPeriod)

# 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/ rentalPeriod)

# ii)   mileCharge is $100.00 per week if the average number of miles driven per week exceeds 900 miles

____________________________________________________________________________________________

Please include code that can be copied and screenshots for indents. Thank you.

Homework Answers

Answer #1

If you have any doubts, please give me comment...

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 = int(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: "))

#calulate miles driven

totalMiles = int(odoEnd) - int(odoStart)

#calulating of charges based on miles driven and rental type

averageDayMiles = 0

if rentalCode == "B" :

    mileCharge = totalMiles*0.25

elif rentalCode == "D":

    averageDayMiles = totalMiles/rentalPeriod

    if averageDayMiles <=100 :

        extraMiles = 0

    else:

        extraMiles = float(averageDayMiles - 100)

    mileCharge = float(extraMiles*0.25)

else:

    averageWeeklyMiles = totalMiles/rentalPeriod

    if averageWeeklyMiles <=900:

        extraMiles = 0

    else:

        extraMiles = float(totalMiles - 900)

    mileCharge += float(extraMiles*100)

amtDue = baseCharge + mileCharge

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: $%.2f"%amtDue)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Calculating Charges - Part 2 Calculate the mileage charge Depending on the rental type, the mileage...
Calculating Charges - Part 2 Calculate the mileage charge Depending on the rental type, the mileage charge is calculated differently. You will need to create additional code to calculate the mileage charge for each type of rental. Store the cost of miles driven as the variable mileCharge Set the user input equal to rentalCode. rentalCode = input("(B)udget, (D)aily, or (W)eekly rental?\n") Prompt the user to input the Rental Code. Prompt: "(B)udget, (D)aily, or (W)eekly rental?\n" Variable: rentalCode = ? Code...
CSE 231                                         &n
CSE 231                                                                                                                        Fall 2019 Project #2 ## Language Should be Python. Assignment Specifications The program will compute and display information for a company which rents vehicles to its customers. For a specified customer, the program will compute and display the amount of money charged for that customer’s vehicle rental. The program should start by asking the user if he wants to continue. The answer is ‘Y’ for yes or ‘N’ for no. You can check the value with Boolean expressions such...
1. In python code create 5 variables: street, city, number, state, zipcode. Then print using the...
1. In python code create 5 variables: street, city, number, state, zipcode. Then print using the variable names in the standard of a mail address. 2. Use a flow chart to describe this algorithm: "Tell the user to input their yearly wage. Then calculate how much they make per week off of 1 year salary.
Create a Java Program to calculate luggage costs. The Business Rules are: A. Two bags per...
Create a Java Program to calculate luggage costs. The Business Rules are: A. Two bags per person are free. B. The Excess Bag Charge is $75 per bag. The program needs to do the following: 1. In your main method(),    Create integers to store the number of Passengers and also the total number of bags    Prompt for the number of passengers on a ticket.    Prompt for the total number of bags for all passengers on a ticket....
Cascade’s management is considering the proposal from FHP. There are many issues involving strategy,cost, risk, and...
Cascade’s management is considering the proposal from FHP. There are many issues involving strategy,cost, risk, and capacity. Prepare a recommendation to management. Use the following questions to guide your analysis. Assume Cascade could service the contract with existing equipment. Use Exhibit 1 to identify the relevant costs concerning the acceptance of FHP’s request to add two additional loads per week. Which costs are not relevant? Why? Calculate the contribution per mile and total annual contribution associated with accepting FHP’s proposal....
For this assignment, you will be creating a simple “Magic Number” program. When your program starts,...
For this assignment, you will be creating a simple “Magic Number” program. When your program starts, it will present a welcome screen. You will ask the user for their first name and what class they are using the program for (remember that this is a string that has spaces in it), then you will print the following message: NAME, welcome to your Magic Number program. I hope it helps you with your CSCI 1410 class! Note that "NAME" and "CSCI...
In Java please 10.9 Lab 6 In BlueJ, create a project called Lab6 Create a class...
In Java please 10.9 Lab 6 In BlueJ, create a project called Lab6 Create a class called LineSegment –Note: test changes as you go Copy the code for LineSegment given below into the class. Take a few minutes to understand what the class does. Besides the mutators and accessors, it has a method called print, that prints the end points of the line segment in the form: (x, y) to (x, y) You will have to write two methods in...
Task #4 Calculating the Mean Now we need to add lines to allow us to read...
Task #4 Calculating the Mean Now we need to add lines to allow us to read from the input file and calculate the mean. Create a FileReader object passing it the filename. Create a BufferedReader object passing it the FileReader object. Write a priming read to read the first line of the file. Write a loop that continues until you are at the end of the file. The body of the loop will: convert the line into a double value...
Wal-Mart Online Wal-Mart is one of the largest companies in America. It is definitely the largest...
Wal-Mart Online Wal-Mart is one of the largest companies in America. It is definitely the largest retailer, both in terms of the number of stores (8,970 worldwide in 2011) and the level of sales ($419 billion from the 2011 Annual Report). By pushing suppliers to continually reduce costs, Wal-Mart is known for pursuing low prices and the stores often attract customers solely in-terested in lower prices. With Wal-Mart’s expansion into groceries, the company has be-come the largest retail grocer in...
UPS COMPETES GLOBALLY WITH INFORMATION TECHNOLOGY United Parcel Service (UPS) started out in 1907 in a...
UPS COMPETES GLOBALLY WITH INFORMATION TECHNOLOGY United Parcel Service (UPS) started out in 1907 in a closet-sized basement office. Jim Casey and Claude Ryan—two teenagers from Seattle with two bicycles and one phone—promised the “best service and lowest rates.” UPS has used this formula successfully for more than a century to become the world’s largest ground and air package-delivery company. It’s a global enterprise with nearly 400,000 employees, 96,000 vehicles, and the world’s ninth largest airline. Today UPS delivers 16.3...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT