Question 3 (d) Extend the design of the class in Question 3 (c) to include a subclass of the WaterTaxiFare class, called CharterWaterfare, that creates an object with the following additional characteristics: • destination is the chosen destination of the passenger(s) who have chartered the water taxi; there are three possible destinations, D1, D2 or D3 (default value "N/A") Three constant class variables should be defined to hold the cost to charter the water taxi to each of the three destinations. The cost of D1 is $25.50, D2 is $33.75 and D3 is $48.00. If an invalid destination is entered (or the default value is used) then the cost should be $0. The class definition should also include the following method(s): • a constructor/initializer method to initialize the instance variables; be sure to include the default values • accessor methods for the instance variable • a computeCharges method that returns the total charges for the chartered water taxi fare, using the instance variables and the constant class variables and the computeCharges method from its parent class; recall that an invalid or default destination should return a charge of 0 • special method_str_() to print the required information as shown in the sample output, including the taxi ID, the operator, the cost of the ride, and the destination, with appropriate descriptive labels

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Question 3 (d)
Extend the design of the class in Question 3 (c) to include a subclass of the WaterTaxiFare class,
called CharterWaterFare, that creates an object with the following additional characteristics:
• destination is the chosen destination of the passenger(s) who have chartered the water taxi; there
are three possible destinations, D1, D2 or D3 (default value "N/A")
Three constant class variables should be defined to hold the cost to charter the water taxi to each of
the three destinations. The cost of D1 is $25.50, D2 is $33.75 and D3 is $48.00. If an invalid
destination is entered (or the default value is used) then the cost should be $0.
The class definition should also include the following method(s):
• a constructor/initializer method to initialize the instance variables; be sure to include the default
values
accessor methods for the instance variable
a computeCharges method that returns the total charges for the chartered water taxi fare, using
the instance variables and the constant class variables and the computeCharges method from its
parent class; recall that an invalid or default destination should return a charge of 0
special method_str
including the taxi ID, the operator, the cost of the ride, and the destination, with appropriate
descriptive labels
) to print the required information as shown in the sample output,
Transcribed Image Text:Question 3 (d) Extend the design of the class in Question 3 (c) to include a subclass of the WaterTaxiFare class, called CharterWaterFare, that creates an object with the following additional characteristics: • destination is the chosen destination of the passenger(s) who have chartered the water taxi; there are three possible destinations, D1, D2 or D3 (default value "N/A") Three constant class variables should be defined to hold the cost to charter the water taxi to each of the three destinations. The cost of D1 is $25.50, D2 is $33.75 and D3 is $48.00. If an invalid destination is entered (or the default value is used) then the cost should be $0. The class definition should also include the following method(s): • a constructor/initializer method to initialize the instance variables; be sure to include the default values accessor methods for the instance variable a computeCharges method that returns the total charges for the chartered water taxi fare, using the instance variables and the constant class variables and the computeCharges method from its parent class; recall that an invalid or default destination should return a charge of 0 special method_str including the taxi ID, the operator, the cost of the ride, and the destination, with appropriate descriptive labels ) to print the required information as shown in the sample output,
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY