This laboratory requires you to write a Java program to use the OOP concepts such as...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
This laboratory requires you to write a Java program to use the OOP concepts such as the inheritance, polymorphism, abstract class/method, and interface to implement the program. Task Implement classes Time, Stop, Transport, Bus, Train, Ferry, Coach, and TransportManager based on the UML class diagram below. TransportManager -transports: ArrayList<Transport +TransportManager) inputTransport:void add Transport Transport); void *printTransport(): void Bus -route: String -stops: ArrayList<Stop> +Bus() +Bus(String) +addStop(Stop) void Train 0.n +inputData(Scanner): void +outputData(): void +toString(): String -line: String -stops: ArrayList<Stop> +Train() +Train(String) addStop(Stop) void «interface Mylo +printTime Table:void Transport +Time() -hour: int -minute: int On Stop 4 -name: String -arrivalTime: Time -departure Time: Time +Stop() +Stop(String. Time, Time) Time(int int) +Time(Time) 2 Time Ferry -route: String -stops: ArrayList<Stop> +Fony() +Ferry(String) +addStop(Stop) void on Coach -departureCity: String -departure Time: Time -destinationCity: String -arrivalTime: Time Coach() Coach(String, Time, String, Time) Implement the system according to the given UML class diagrams. If you add new classes, fields or methods to the UML class diagrams, please also include the new diagram in your submission. The program shall ● ● ● be consistent with the UML class diagrams; follow the conventions for naming all classes, variables, and methods; provide sufficient comments; use proper blank spaces, indentation and braces to make your code easy to read and understand; implement the methods from the interface; implement abstract superclass; override abstract methods in the subclass with polymorphism; use the instanceof and downcasting to cast a superclass object to a subclass object for calling the specific methods defined in the subclass. Write the main method in a class TransportManager to test the program. The sample outputs can be found below. The user's inputs are highlighted in red colour. Input a bus route: Gong Input how many stops: 3 Stop 1 name: uow Input hour minute: 10 10 Input hour minute: 10 20 Stop 2 name: hospital Input hour minute: 10 30 Input hour minute: 10 30 Stop 3 name: centre Input hour minute: 10 40 Input hour minute: 10 40 Input a departure city: wollongong Input hour minute: 10 10 Input a destination city: sydney Input hour minute: 12 10 Input a train line: southern-cost Input how many stops: Stop 1 name: central Input hour minute: 8 10 Input hour minute: 8 15 Stop 2 name: wollongong Input hour minute: 10 20 Input hour minute: 10 25 Input a ferry route: ZOO Input how many stops: 2 Stop 1 name: ZOO Input hour minute: 10 10 Input hour minute: 10 12 Stop 2 name: darling Input hour minute: 10 20 Input hour minute: 10 25 Bus route Gong Stop: uow Arrival at 10:10 Departure at 10:20 Stop: hospital Arrival at 10:30 Departure at 10:30 Stop: centre Arrival at 10:40 Departure at 10:40 Coach departure from wollongong at 10:10 arrival to sydney at 12:10 Train line southern-cost Stop: central Arrival at 8:10 Departure at 8:15 Stop: wollongong Arrival at 10:20 Departure at 10:25 Ferry route zoo Stop: zoo Arrival at 10:10 Departure at 10:12 Stop: darling Arrival at 10:20 Departure at 10:25 This laboratory requires you to write a Java program to use the OOP concepts such as the inheritance, polymorphism, abstract class/method, and interface to implement the program. Task Implement classes Time, Stop, Transport, Bus, Train, Ferry, Coach, and TransportManager based on the UML class diagram below. TransportManager -transports: ArrayList<Transport +TransportManager) inputTransport:void add Transport Transport); void *printTransport(): void Bus -route: String -stops: ArrayList<Stop> +Bus() +Bus(String) +addStop(Stop) void Train 0.n +inputData(Scanner): void +outputData(): void +toString(): String -line: String -stops: ArrayList<Stop> +Train() +Train(String) addStop(Stop) void «interface Mylo +printTime Table:void Transport +Time() -hour: int -minute: int On Stop 4 -name: String -arrivalTime: Time -departure Time: Time +Stop() +Stop(String. Time, Time) Time(int int) +Time(Time) 2 Time Ferry -route: String -stops: ArrayList<Stop> +Fony() +Ferry(String) +addStop(Stop) void on Coach -departureCity: String -departure Time: Time -destinationCity: String -arrivalTime: Time Coach() Coach(String, Time, String, Time) Implement the system according to the given UML class diagrams. If you add new classes, fields or methods to the UML class diagrams, please also include the new diagram in your submission. The program shall ● ● ● be consistent with the UML class diagrams; follow the conventions for naming all classes, variables, and methods; provide sufficient comments; use proper blank spaces, indentation and braces to make your code easy to read and understand; implement the methods from the interface; implement abstract superclass; override abstract methods in the subclass with polymorphism; use the instanceof and downcasting to cast a superclass object to a subclass object for calling the specific methods defined in the subclass. Write the main method in a class TransportManager to test the program. The sample outputs can be found below. The user's inputs are highlighted in red colour. Input a bus route: Gong Input how many stops: 3 Stop 1 name: uow Input hour minute: 10 10 Input hour minute: 10 20 Stop 2 name: hospital Input hour minute: 10 30 Input hour minute: 10 30 Stop 3 name: centre Input hour minute: 10 40 Input hour minute: 10 40 Input a departure city: wollongong Input hour minute: 10 10 Input a destination city: sydney Input hour minute: 12 10 Input a train line: southern-cost Input how many stops: Stop 1 name: central Input hour minute: 8 10 Input hour minute: 8 15 Stop 2 name: wollongong Input hour minute: 10 20 Input hour minute: 10 25 Input a ferry route: ZOO Input how many stops: 2 Stop 1 name: ZOO Input hour minute: 10 10 Input hour minute: 10 12 Stop 2 name: darling Input hour minute: 10 20 Input hour minute: 10 25 Bus route Gong Stop: uow Arrival at 10:10 Departure at 10:20 Stop: hospital Arrival at 10:30 Departure at 10:30 Stop: centre Arrival at 10:40 Departure at 10:40 Coach departure from wollongong at 10:10 arrival to sydney at 12:10 Train line southern-cost Stop: central Arrival at 8:10 Departure at 8:15 Stop: wollongong Arrival at 10:20 Departure at 10:25 Ferry route zoo Stop: zoo Arrival at 10:10 Departure at 10:12 Stop: darling Arrival at 10:20 Departure at 10:25
Expert Answer:
Answer rating: 100% (QA)
output This code defines classes for different types of transportation ... View the full answer
Related Book For
Data Structures And Algorithms In C++
ISBN: 9780470383278
2nd Edition
Authors: Michael T. Goodrich, Roberto Tamassia, David M. Mount
Posted Date:
Students also viewed these programming questions
-
RES501 Instructions Read the situation, then complete the two parts and associated tasks that follow. Submit all your answers in one document. Write the number of each question you are answering....
-
IssueTracking System (ITS) Description An Issue Tracking System (ITS) isa computer software application that manages and maintains lists ofissues, as needed by departments of an organization to help...
-
I need to write a Java program that does the following with the given code: Instructions: The fish tank has 2 modes of status, fish manipulation and simulation. In the fish manipulation status, the...
-
As a preliminary to requesting budget estimates of sales, costs, and expenses for the fiscal year beginning January 1, 2009, the following tentative trial balance as of December 31, 2008, is prepared...
-
Excerpts from the June 31, 1994, balance sheet of The Quaker Oats Company (now part of PepsiCo, Inc.) are provided below (dollars in millions). REQUITED:a. The notes to the company's 1992 financial...
-
What is the significance of social innovation? How does it differ from organizational innovation?
-
Beng-Yu Woo, Xiaoming Li, and Vivian Hsiun created and patented an invention titled Full Duplex Single Chip Video Codec. At the time, Woo, Li, and Hsiun were employees of Infochips Systems, Inc....
-
Cusick Department Store is located near the Village Shopping Mall. At the end of the company??s calendar year on December 31, 2012, the following accounts appeared in two of its trial balances....
-
Explain the types of anomalies that might occur on this relational model when not normaliz ed NORMALIZATION (40 Points) Consider a COLLEGE logical relational model below....
-
Shauna Coleman is single. She works as an architectural designer for Streamline Design (SD). Shauna wanted to determine her taxable income. She correctly calculated her AGI. However, she wasn't sure...
-
(8) Let X-b(n,p), with E(X)=6 and var(X)-4.2, then P(X 6)=0.608. OT OF
-
You are a full time employee of an online company. The company is being audited by the IRS. You are in the payroll department and not an accountant. You are given full authority to handle the audit....
-
Your client has just been audited by the irs and an agreement has been reached with the irs agent regarding the proposed adjustments. What form will the irs agent prepare and give to your client and...
-
WHEN WORKING WITH THE CLIENTS TO ADVOCATE TO CHANGE WHAT ARE THE MANDATORY REORTING REQUIREMENTS?
-
Carolina Beach Chair Inc. is considering buying the cup holders for the beach chairs they manufacture, instead of producing them. Carolina's costs for each cup holder include Direct Materials $0.85,...
-
what would be Amber's nominal payback, discounted payback, net present value, and the internal rate of return?
-
Requirement 1. Prepare the classified balance sheet of Carrie O'Connell Dance Studio Company at August 31, 2024. Use the report form. You must compute the ending balance of Retained Earnings. Begin...
-
What is master production scheduling and how is it done?
-
Suppose each node v of a binary tree T is labeled with its value (v) in a level numbering of T. Design a fast method for determining (u) for the lowest common ancestor (LCA), u, of two nodes v and...
-
Implement the binary tree representation of the tree ADT. You may reuse the Linked Binary Tree implementation of a binary tree.
-
Explain why the case where the right child of r is internal and the left child is external was not considered in the description of down-heap bubbling.
-
For the finite square well potential, prove the formula for the transmission coefficient (7.83), calculate \(R\), and prove that \(|R|^{2}+T=1\). Equation 7.83:- T = |S|2 K3 = 42 2(+)2 cos KL + (2 +...
-
Consider an asymmetric potential barrier, with Calculate the tunneling probability \(T\) for energy \(U_{1} U_{0}\). 0, x < 0 U(x) = U> U, 0 < x 0, x > L. (7.96)
-
The data in Table 1 represent the first exam score of 10 students enrolled in Introductory Statistics. Treat the 10 students as a population. (a) Compute the population mean. (b) Find a simple random...
Study smarter with the SolutionInn App