Question

In: Computer Science

Rental Summary Calculate the Amount Due. amtDue = baseCharge + mileCharge Print the Customer summary as...

Rental Summary

  1. Calculate the Amount Due.
    amtDue = baseCharge + mileCharge

  2. Print the Customer summary as follows:

Rental Summary
Rental Code:        The rental code
Rental Period:      The number of days the vehicle was rented
Starting Odometer:  The vehicle's odometer reading at the start of the rental period
Ending Odometer:    The vehicle's odometer reading at the end of the rental period
Miles Driven:       The number of miles driven during the rental period
Amount Due:         The amount of money billed displayed with a dollar sign and
                    rounded to two digits. For example, $125.99 or $43.87                   

Final Check
Remove ALL print code from your script, except for the Rental Summary.
The following data will be used in this final check:

Rental Code:        D
Rental Period:      5
Starting Odometer:  1234
Ending Odometer:    2222

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

Rental Summary Feedback Link

Before you submit your final code file for grading, it might be a good idea to get some feedback as a final check. This feedback is for your benefit and this will not submit your code for grading.

If so, click the Help Me! link below.

Help Me!

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 = ?
rentalCode = input("(B)udget, (D)aily, or (W)eekly rental?\n")
print(rentalCode)
budget_charge = 40.00
daily_charge = 60.00
weekly_charge = 190.00
#2)   Request time period the car was rented.

#Prompt --> "Number of Days Rented:"
#rentalPeriod = ?
#   OR
#Prompt --> "Number of Weeks Rented:"
#rentalPeriod = ?
if rentalCode == 'B' or rentalCode == 'D':
rentalPeriod= int(input('Number of Days Rented:\n'))
else:
rentalPeriod =int(input('Number of Weeks Rented:\n'))

daysRented = 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: Display the results to the customer
'''
#1) Calculate the Amount Due as the variable amtDue
# This is the base charge + mile charge

#2. Display the results of the rental calculation:

print ("Rental Summary")
print("Rental Code: ", rentalCode)
print ("Rental Period: ", rentalPeriod)
print ("Starting Odometer: ", odoStart)
print ("Ending Odometer: ", odoEnd)
print ("Miles Driven: ", totalMiles)
print ("Amount Due: ", amtDue)

Solutions

Expert Solution

import sys

# Collecting Customer Data Part-1
rentalCode = input("(B)udget, (D)aily, or (W)eekly rental?\n")
# print(rentalCode)
budget_charge = 40.00
daily_charge = 60.00
weekly_charge = 190.00
if (rentalCode == 'B' or rentalCode == 'D'):
    rentalPeriod = int(input('Number of Days Rented:\n'))
else:
    rentalPeriod = int(input('Number of Weeks Rented:\n'))
# Customer Data Check 1
if (rentalCode == 'B'):
    baseCharge = float(rentalPeriod * budget_charge)
elif (rentalCode == 'D'):
    baseCharge = float(rentalPeriod * daily_charge)
else:
    baseCharge = float(rentalPeriod * weekly_charge)
# print("Base Charge=", baseCharge)
# Collecting Customer Data Part-2

odoStart = int(input("Starting Odometer Reading:\n"))
odoEnd = int(input("Ending Odometer Reading:\n"))
totalMiles = odoEnd - odoStart

# Calculate Charges 2
averageDayMiles = float(totalMiles / rentalPeriod)
if (rentalCode == 'B'):
    mileCharge = float(0.25 * totalMiles)
elif (rentalCode == 'D'):
    if (averageDayMiles > 100):
        extraMiles = averageDayMiles - 100
        mileCharge = float(extraMiles * 0.25)
    else:
        mileCharge = 0
else:
    if (averageDayMiles > 900):
        mileCharge = float(rentalPeriod * 100)
# print("Mile Charge", mileCharge)
amtDue = baseCharge + mileCharge
# Displaying Results to the Customer

print("Rental Summary")
print("Rental Code: ", rentalCode)
print("Rental Period: ", rentalPeriod)
print("Starting Odometer: ", odoStart)
print("Ending Odometer: ", odoEnd)
print("Miles Driven: ", totalMiles)
print("Amount Due: $%.2f" % amtDue, sep='')

Related Solutions

Customer Amount of Tip Amount of Bill Number of Diners Customer Amount of Tip Amount of...
Customer Amount of Tip Amount of Bill Number of Diners Customer Amount of Tip Amount of Bill Number of Diners 1 $ 7.70 $ 46.02 1 16 $ 3.30 $ 23.59 2 2 4.50 28.23 4 17 3.50 22.30 2 3 1.00 10.65 1 18 3.25 32.00 2 4 2.40 19.82 3 19 5.40 50.02 4 5 5.00 28.62 3 20 2.25 17.60 3 6 4.25 24.83 2 21 3.90 58.18 1 7 0.50 6.25 1 22 3.00 20.27 2...
Which of the following is NOT a task? 1) Calculate settlement amount 2) Determine if customer...
Which of the following is NOT a task? 1) Calculate settlement amount 2) Determine if customer is liable for damage 3) Insurance policy does not cover the damage 4) Check insurance policy details
Using C++ Write a program to calculate the amount a customer should pay in a checkout...
Using C++ Write a program to calculate the amount a customer should pay in a checkout counter for the purchases in a bagel shop. The products sold are bagels, cream cheese, and coffee. Use the pseudo code discussed in the class to write the program. Make reasonable assumptions about the prices of bagel, cream cheese, and coffee. Declare prices of bagel, cream cheese, and coffee as constants.
How do you calculate 1984 constant dollars for the rental revenue if 1984 rental revenue =...
How do you calculate 1984 constant dollars for the rental revenue if 1984 rental revenue = $13,366.55 and CPI = 103.933? calculate 2012 constant dollars for the rental revenue. 2012 rental revenue = 40,892.75 and CPI = 229.604?
Table #10.1.6 contains the value of the house and the amount of rental income in a...
Table #10.1.6 contains the value of the house and the amount of rental income in a year that the house brings in ("Capital and rental," 2013). Create a scatter plot and find a regression equation between house value and rental income. Then use the regression equation to find the rental income a house worth $230,000 and for a house worth $400,000. Which rental income that you calculated do you think is closer to the true rental income? Why? Table #10.1.6:...
The table below contains the value of the house and the amount of rental income in...
The table below contains the value of the house and the amount of rental income in a year that the house brings in ("Capital and rental," 2013). Table: Data of House Value versus Rental Value Rental Value Rental Value Rental Value Rental 81000 6656 77000 4576 75000 7280 67500 6864 95000 7904 94000 8736 90000 6240 85000 7072 121000 12064 115000 7904 110000 7072 104000 7904 135000 8320 130000 9776 126000 6240 125000 7904 145000 8320 140000 9568 140000 9152...
Table #10.1.6 contains the value of the house and the amount of rental income in a...
Table #10.1.6 contains the value of the house and the amount of rental income in a year that the house brings in ("Capital and rental," 2013). Find the correlation coefficient and coefficient of determination and then interpret both. VALUE RENTAL VALUE RENTAL VALUE RENTAL VALUE RENTAL 81000 6656 77000 4576 75000 7280 67500 6864 95000 7904 94000 8736 90000 6240 85000 7072 121000 12064 115000 7904 110000 7072 104000 7904 135000 8320 130000 9776 126000 6240 125000 7904 145000 8320...
Determine the due date and the amount of interest due at maturity on the following notes....
Determine the due date and the amount of interest due at maturity on the following notes. When calculating interest amounts, assume there are 350 days in a year. Note Issue Date Amount Interest Rate Time(Days) 1.   Jan. 20 $100,000 6% 30 2. March 10 $50,000 3% 60 3. May 15 $85,000 4% 45 4. Sept. 21 $90,000 7% 90    5. Dec.1    $75,000   8% 120 Note Due Date Interest on Note Maturity Value Select an answer: a. Feb. 19,...
Determine the due date and the amount of interest due at maturity on the following notes....
Determine the due date and the amount of interest due at maturity on the following notes. Assume 360 days per year. Date of Note Face Amount Interest Rate Term of Note (a) October 1 $21,000 8% 60 days (b) August 30 9,000 10 120 days (c) May 30 12,000 12 90 days (d) March 6 15,000 9 60 days (e) May 23 9,000 10 60 days Due Date Interest 1. $ 2. 3. 4. 5.
The customer expectation when phoning a customer service line is that the average amount of time...
The customer expectation when phoning a customer service line is that the average amount of time from completion of dialing until they hear the message indicating the time in queue is equal to 55.0 seconds (less than a minute was the response from customers surveyed, so the standard was established at 10% less than a minute).   You decide to randomly sample at 20 times from 11:30am until 9:30pm on 2 days to determine what the actual average is.  The actual data...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT