Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.
  •   

Example Runs Run 1 Rgistaration of vehicle 1 : What is the type of vehicle (SUV Minivan - Sedan - Hatchback -Van)? Sedan what is the vehicle capacity for vehicle 1? 3 what is the year of manufacture for vehicle 1? 2017 Vehicle 1 has been registered is vehicle 1 available (True or False)? True Rgistaration of vehicle 2 : what is the type of vehicle (SUV - Minivan - Sedan Hatchback -Van)? van What is the vehicle capacity for vehicle 2? 6 What is the year of manufacture for vehicle 2? 2821 Vehicle 2 has been registered is vehicle 2 available (True or False)? False Rgistaration of vehicle 3 : what is the type of vehicle (SUV - Minivan - Sedan Hatchback -Van)? SUV what is the vehicle capacity for vehicle 3? 4 What is the year of manufacture for vehicle 3? 2019 Vehicle 3 has been registered is vehicle 3 available (True or False)? True Enter the information of the ride Enter the number of passengers: 3 Enter the minimum manufacturing year of the vehicle: 2017 The suggested vehicle(s) for you are: vehicle type: Sedan year: 2017 Vehicle type: SUV year: 2019

Step by Step Solution

There are 3 Steps involved in it

Step: 1

QUESTION These days many people request vehicles by phone application to drive them around The rider can keyin the features of the vehicle they are looking for In this task you are going to build a sy... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Applying Communication Theory For Professional Life A Practical Introduction

Authors: Marianne Dainton, Elaine D. Zelley

4th Edition

150631547X, 978-1506315478

More Books

Students also viewed these Operating System questions