Computer Science There are clearly some similarities in the implementations of Taxi and Shuttle that suggest use of inheritance to represent them. Introducing inheritance is the primary task of this assessment. -The Ezcab class, The Ezcab class maintains separate lists of taxis and shuttles and destinations with destination fares (you can hardcode destination fares). It has a lookup method that searches for a taxi/shuttle with a given ID. -The Taxi and Shuttle classes share some common attributes – location and destination. They also have some common methods – getLocation, getDestination, getStatus and setDestination. -Vehicle is the superclass of both Taxi and Shuttle. This class involves placing the common fields and methods into Vehicle and removing them from Taxi and Shuttle. -Modify Taxi and Shuttle class to indicate that it is a subclass of Vehicle. You can keep the id field in Vehicle class and getId,SetId methods. -Arrange for Taxi's constructor to call the constructor of Vehicle so that a value for id is passed. -In the Shuttle class, Make Shuttle a subclass of Vehicle. You will have to make a very similar additions in this class to those you have just made to Taxi. -The original getStatus method of the Taxi/Shuttle class will be printed available if a taxi was available. -A new method is required in the Ezcab class. The idea is that a customer wants to book a shuttle or a taxi to a particular destination. The destination is passed as a parameter to the method. -This method must return a Vehicle which is: Either: a shuttle whose next stop (i.e., destination) is where the customer wants to go, or a taxi that is free (i.e., has a null destination). If no suitable shuttle is available, and no taxi is free, then this method should return “Not available” or you can also take a isAvailable as boolean variable setting it to true or false. -A customer will always prefer a suitable shuttle because they are cheaper so if there is a suitable shuttle then that must be returned. It is important to be able to distinguish between a shuttle whose next destination may not be the customers destination, whereas for the taxi that is already booked to go directly to the destination. -Payment interface will deal with fare amounts for taxis and shuttle. Its dependant on the destinations. Include methods getFare() for a customer and display the total fare -Test all methods in TestMain class.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

Computer Science

There are clearly some similarities in the implementations of Taxi and Shuttle that suggest use of inheritance to represent them. Introducing inheritance is the primary task of this assessment.

-The Ezcab class, The Ezcab class maintains separate lists of taxis and shuttles and destinations with destination fares (you can hardcode destination fares). It has a lookup method that searches for a taxi/shuttle with a given ID.

-The Taxi and Shuttle classes share some common attributes – location and destination. They also have some common methods – getLocation, getDestination, getStatus and setDestination.

-Vehicle is the superclass of both Taxi and Shuttle. This class involves placing the common fields and methods into Vehicle and removing them from Taxi and Shuttle.

-Modify Taxi and Shuttle class to indicate that it is a subclass of Vehicle. You can keep the id field in Vehicle class and getId,SetId methods.

-Arrange for Taxi's constructor to call the constructor of Vehicle so that a value for id is passed.

-In the Shuttle class, Make Shuttle a subclass of Vehicle. You will have to make a very similar additions in this class to those you have just made to Taxi. -The original getStatus method of the Taxi/Shuttle class will be printed available if a taxi was available.

-A new method is required in the Ezcab class. The idea is that a customer wants to book a shuttle or a taxi to a particular destination. The destination is passed as a parameter to the method.

-This method must return a Vehicle which is: Either: a shuttle whose next stop (i.e., destination) is where the customer wants to go, or a taxi that is free (i.e., has a null destination). If no suitable shuttle is available, and no taxi is free, then this method should return “Not available” or you can also take a isAvailable as boolean variable setting it to true or false.

-A customer will always prefer a suitable shuttle because they are cheaper so if there is a suitable shuttle then that must be returned. It is important to be able to distinguish between a shuttle whose next destination may not be the customers destination, whereas for the taxi that is already booked to go directly to the destination.

-Payment interface will deal with fare amounts for taxis and shuttle. Its dependant on the destinations. Include methods getFare() for a customer and display the total fare

-Test all methods in TestMain class.

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT