Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 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
Step by Step Solution
★★★★★
3.39 Rating (149 Votes )
There are 3 Steps involved in it
Step: 1
output This code defines classes for different types of transportation ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started