Question: Write a program in Python that implements the class design from HW08A and then implements the requirements listed below in sequence. Note that it is

Write a program in Python that implements the class design from HW08A and then implements the requirements listed below in sequence. Note that it is acceptable to adjust the class design from HW08A to accommodate these requirements. Assume that no input data validations are needed. The program should create records for two cars with data as provided below and prompt for user input for data to create a third car record. Note: The second car is new and has never been rented before.

Car VIN Year Color Odometer Rental Miles Rental Days No. of rentals

1 101 2016 Blue 40000 35000 600 50

2 102 2021 Red 15

The program should print the basic information (VIN, make, year, color, & odometer reading) for Car 1. The program should process the following set of transactions (and, optionally, feel free to make up any transactions for the third car):

Car 1 rented for 10 days and returned with odometer reading 42065

Car 2 rented for 3 days and returned with odometer reading 1181

Car 2 rented for 3 days and returned with odometer reading 1400

Car 2 rented for 5 days and returned with odometer reading 2122

Car 1 taken for service and returned with odometer reading 42080

Car 2 rented for 7 days and returned with odometer reading 3123

Car 1 rented for 12 days and returned with odometer reading 44786

Car 1 painted yellow

Car 2 rented for 14 days and returned with odometer reading 4357

The program should print the basic information (VIN, make, year, color, & odometer reading) for Car 1.

The program should check and then display whether Car 1 should be sold.

The program should display the total number of cars.

The program should compute and display the following metrics for each car. Note that cars in their first year i.e. less than a year old are considered to be a year old for these metrics, cars in their second year are two years old, and so on.

Average rental miles per year

Average rental days per year

Average number of times rented per year

Average number of miles per rental

Average number of days per rental

HW08A

Fancy Car Rentals, Inc. has a fleet of one type of car only DMC DeLorean from different model years. They need to organize information about the individual cars that make up the fleet. This information is used in different ways. For instance, they prefer to get rid of cars that are more than 3 years old or have more than 50,000 miles on the odometer. Besides the basic information such as VIN (vehicle ID number), year, and color, they also want to know for each car: how many miles it has been driven while out on rentals, how many total days it has been rented out, and the number of times it has been rented out. This information is useful for analysis of the productivity of each car as they charge customers by the day and offer unlimited mileage. As customers return a rental car, the odometer reading and number of days it was rented out are noted. Sometimes cars are driven by the staff for non-rental reasons (e.g., to and from maintenance service) and the odometer reading is noted upon completion of such trips as well. Design a class to organize this information and provide appropriate functionality as noted above. In addition, there is a need to keep track of how many car records are created and to be able to print basic information about a car in this format: VIN: 101 Car: DMC DeLorean Year: 2015 Color: Red Odometer: 8800

Define class named Fleet Class attributes: fleet_count which is the count of total no. of cars initially set to 0 car_desc set to DMC_Delorean as it applies to all cars Instance attributes: vin which is a cars VIN (unique id no.) (private read/get only) year which is a cars model year (private read/get only) color which is a cars color odometer which is a cars current odometer reading (private get & set) rent_miles which is a cars total of miles rented (private read/get only) rent_days which is a cars total of days rented (private read/get only) rent_count which is a cars total no. of times rented (private read/get only) Methods (note all require the current object self as input): Need custom constructor method (__init__) as some attributes are private. Input will be values for the seven instance attributes and the method will assign those values to attributes. Method should increment fleet_count Get methods to return all six private attribute values one method per attribute Set method for odometer with input odometer reading (variable miles) C: miles greater than odometer attribute value (so odometer not rolled back) T: private attribute odometer = miles Optionally, could create a property as an interface for the get and set methods for odometer Process_rental - inputs: ending odometer reading (variable odo) and days rented (variable days) Calculate miles driven on rental (miles) as odo minus odometer attribute value Increment the rent_miles attribute value by miles Set the odometer attribute to odo Increment the rent_days attribute value by days Increment the rent_count attribute value by 1 Sell_car input current year (variable curr_yr) Calculate age as curr_yr minus year attribute value C: age greater than 3 or odometer attribute value > 50000 T: provide/return True as output F: provide/return False as output Print_info no input Display "VIN:" and vin attribute value Display "Car:" and car_desc attribute value Display "Year:" and year attribute value Display "Color:" and color attribute value Display "Odometer:" and odometer attribute value

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!