These days, many people request vehicles by phone application to drive them around. The rider can key-in
Question:
These days, many people request vehicles by phone application to drive them around. The rider can key-in the features of the vehicle they are looking for. In this task, you are going to build a system that suggests vehicles to a user from a list of vehicles. The suggestions should be based on the availability, number of passengers, and the manufacturing year.
Create a class called Vehicle that has the following attributes:
- vehicle type
- vehicle capacity
- year -- referring to the year of manufacturing
- availablity (Boolean value)
Your task is to write the followin methods for the Vehicle class:
- Write method to set the values of the vehicle type, vehicle capacity and year.
- Write method to set the value of the availability variable.
- Write method to check the availability of the vehicle.
Write another class called Ride that has the following attributes:
- Number of passengers
- Vehicle year (the use can set the minimum years)
Your task is to write the following code for the Ride class:
- Write a constructor method to initialize the Ride attributes
- Write a method that takes the list of vehicles and return the available vehicles that suites the ride based on the availability, number of passengers, and the minimum year of manufacture.
In the main program you need to write the following code:
- Use a for-loop to register 3 vehicles and store them in a list.
- Set the availablity attribute value of each vehicle using the method you defined earlier. You need to ask the user to key-in the value of the vailablity attribute.
- create a Ride object. Ask the user to key in the object attributes.
- You must call the method in the Ride class to suggest the suitable vehicle(s).
Requirements
To achieve full marks for this task, you must follow the instructions above when writing your solution. Additionally, your solution must adhere to the following requirements:
- Two classes only must be defined.
- You must raise errors if the user key-in incorrect data types.
- You must use a list to store 3 objects of the class Vehicle.
- You must use a for-loop to read the attributes of the 3 vehicle from the user.
Applying Communication Theory For Professional Life A Practical Introduction
ISBN: 9781506315478
4th Edition
Authors: Marianne Dainton, Elaine D. Zelley