a) Write a Python class to represent a Vehicle which includes make string, model string, 17 character VIN, vehicle type (small, medium, large), and 4 digit year. Vehicle object cannot exist without these values. There should be __str__ method to return formatted string with all values.
b) Write test code to create an instance of Vehicle and print the values of the attributes to the console.
a) Write a Python class to represent a vehicle reservation which stores reservation id, pickup date, drop off date, Vehicle object (from earlier exercise), rate per day (vehicle type: small=$29.99, medium=$39.99, large=$49.99), and total price per reservation. When vehicle reservation instance is created, it must be provided with id, pickup date, drop off date, and Vehicle object. The constructor must assign the values to all the instance attributes. There should be functionality to change the dates and Vehicle object and obtain the price per reservation. The reservation price cannot be changed by the user. There should be __str__ method to return formatted string with all values.
b) Write test code to create an instance of vehicle reservation; obtain and print reservation price; change drop off date and vehicle and obtain and print updated reservation price; and print all the values of the reservation.
Get Free Quote!
443 Experts Online