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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education