Question

1. Write a python script that will compute and display information for a company which rents...

1. Write a python script that 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 after prompting the user to enter the following four items for a given customer (in the specified order)

 The car type (a character either C (compact), M (mid-size), L (luxury), S (SUV), or V (Van) )  The number of days the vehicle was rented (an integer)  The vehicle's odometer reading at the start of the rental period (an integer)  The vehicle's odometer reading at the end of the rental period (an integer)  Cleaning Fee is $20 for types C, M, V, and L; and $40 for SUV

The program will compute the amount of money that the customer will be billed, based on the car type, number of days in the rental period, and number of miles driven and the cleaning fee. The program will recognize both upper case and lower case letters for the classification codes.

Type 'C': base charge: $20.00 for each day mileage charge: $0.25 for each mile driven 

Type 'M': base charge: $29.50 for each day mileage charge: $0.29 for each mile driven 

Type 'L': base charge: $44.25 for each day mileage charge: $0.48 for each mile driven 

Type 'SUV': base charge: $40 for each day mileage charge: $0.53 for each mile driven 

Type 'V': base charge: $60.00 for each day mileage charge: no charge if the average number of miles driven per day is 100 miles or less; otherwise, $0.25 for each mile driven above the 100 mile per day limit.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

Program:

import sys

print("*******Car Types*******")
print("Compact-(C or c)")
print("Mid size-(M or m)")
print("Luxury- (L or l)")
print("SUV- (S or s)")
print("Van- (V or v)")


car_type = input("Enter the type of the car do you want? ")

if car_type == 'C' or car_type =='c' or car_type == 'M' or car_type =='m' or car_type == 'L' or car_type =='l' or car_type == 'S' or car_type =='s' or car_type == 'V' or car_type =='v':
no_of_days = int(input("How many days do you want to rent the car? "))
initial_reading = float(input("Enter the speedo meter reading at the start of the rental period: "))
final_reading = float(input("Enter the speedo meter reading at the end of the rental period: "))
else:
print("Invalid Car Type")
sys.exit()
  

if final_reading > initial_reading:
miles_driven = (final_reading - initial_reading)
else:
print("Invalid final reading")
sys.exit()


if car_type == 'C' or car_type == 'c':
total_charge = (no_of_days * 20) + (miles_driven * 0.25) + 20
elif car_type == 'M' or car_type == 'm':
total_charge = (no_of_days * 29.5) + (miles_driven * 0.29) + 20
elif car_type == 'L' or car_type == 'l':
total_charge = (no_of_days * 44.25) + (miles_driven * 0.48) + 20
elif car_type == 'S' or car_type == 's':
total_charge = (no_of_days * 40) + (miles_driven * 0.53) + 40
elif car_type == 'V' or car_type == 'v':
if (miles_driven / no_of_days <= 100):
total_charge = (no_of_days * 60) + 20
else:
total_charge = (no_of_days * 60) + ((miles_driven - no_of_days * 100) * 0.25) + 20

print("The total money charged for rent the car is $",total_charge)

Program Screenshot:

Output:

Add a comment
Know the answer?
Add Answer to:
1. Write a python script that will compute and display information for a company which rents...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in Python The program will compute and display information for a company which rents vehicles to...

    in Python 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. 1. The program will repeatedly prompt the user to enter the following four items for a given customer (in the specified order): a. The customer's classification code (a character) b. The number of days the vehicle was rented (a number) c. The...

  • Section 1: Collect customer input ''' rentalCode = input('(B)udget, (D)aily, or (W)eekly rental?\n') if rentalCode ==...

    Section 1: Collect customer input ''' rentalCode = input('(B)udget, (D)aily, or (W)eekly rental?\n') 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 #Assigning a dollar amount (double floating number) to the varying rates budget_charge = 40.00 daily_charge = 60.00 weekly_charge = 190.00 #baseCharge changes value based on the type of rental code using multiplication #Each branch of if or elif assignes a different value to...

  • what am I missing? this should be the output: (B)udget, (D)aily, or (W)eekly rental? B Starting...

    what am I missing? this should be the output: (B)udget, (D)aily, or (W)eekly rental? B Starting Odometer Reading: Ending Odometer Reading: 1234 2222 988 247.00 my output is this: (B)udget, (D)aily, or (W)eekly rental? Starting Odometer Reading: Ending Odometer Reading: 1234 2222 988 247.00 here's my code so far: import sys ''' Section 1: Collect customer input ''' #Add customer input 1 here, rentalCode = input("(B)udget, (D)aily, or (W)eekly rental?") #Collect Customer Data - Part 2 #4)Collect Mileage information: ##a)...

  • Calculate the base charge if rentalCode == 'B': baseCharge = rentalPeriod * budgetCharge Set the base...

    Calculate the base charge if rentalCode == 'B': baseCharge = rentalPeriod * budgetCharge Set the base charge for the rental type equal to the variable baseCharge. The base charge is the rental period * the appropriate rate: For example: Finish the conditional statement by adding the conditions for other rental codes. import sys ''' Section 1: Collect customer input ''' # For holding cost of miles drive mileCharge = 0 # Reading type of rental rentalCode = input("(B)udget, (D)aily, or...

  • Solve it in access Group Project Note: All documents should be prepared and presented in a...

    Solve it in access Group Project Note: All documents should be prepared and presented in a professional manner, with a cover page showing the group number and the names of group members. Nothing should be hand written hand drawn Michiana Car Rentals Database System Michiana Car Rentals, Inc., headquartered in South Bend, IN, wants to build a database system which would track information customer billing. Usually, a customer picks up a car and then returns after a period of time....

  • Please help, need to code for this business assignment using c++. Business Expense Reimbursements Calculator Probl...

    Please help, need to code for this business assignment using c++. Business Expense Reimbursements Calculator Problem statement: Business trip is part of the enterprise culture. Suppose a businessperson just completed a business trip for your company. Now, you are tasked to write a program that calculates and displays the total travel expenses, allowable expenses for the trip, and the excess that must be paid by the businessperson, if any The program should prompt the user for the following . The...

  • Propose: In this lab, you will complete a Python program with one partner. This lab will...

    Propose: In this lab, you will complete a Python program with one partner. This lab will help you with the practice modularizing a Python program. Instructions (Ask for guidance if necessary): To speed up the process, follow these steps. Download the ###_###lastnamelab4.py onto your desktop (use your class codes for ### and your last name) Launch Pyscripter and open the .py file from within Pyscripter. The code is already included in a form without any functions. Look it over carefully....

  • just the extra credit part please Your customer needs an automated system to patrol the highways....

    just the extra credit part please Your customer needs an automated system to patrol the highways. The job of the system is to collect the following information on vehicles traveling down a certain stretch of highway: license plate number, current speed, and speed limit. A program is required to determine if a speeding ticket is needed for each set of data. Ticket will only be issued when number of miles per hours (mph) over the speed limit is at least...

  • You previously wrote a program that calculates and displays: Miles driven Miles per gallon Kilometers driven...

    You previously wrote a program that calculates and displays: Miles driven Miles per gallon Kilometers driven Liters of fuel consumed Kilometers per liter Messages commenting on a vehicle's fuel efficiency And also validates input Now we'll make a somewhat major change. We'll remove the code for obtaining input from a user and replace it with hardcoded data stored in lists. Because the data is hardcoded, the program will no longer need the code for validating input. So, you may remove...

  • Chapter 7 Question Required 1 Required 2 Required 3 Required 4 Gallatin Carpet Cleaning is a...

    Chapter 7 Question Required 1 Required 2 Required 3 Required 4 Gallatin Carpet Cleaning is a small, family-owned business operating out of Bozeman, Montana. For its services, the company has always charged a flat fee per hundred square feet of carpet cleaned. The current fee is $22.65 per hundred square feet. However, there is some question about whether the company is actually making any money on jobs for some customers-particularly those located on remote ranches that require considerable travel time....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT