Question
Create a BusRoute class that uses the Bus and Time class. This class will represent a bus route between two bus stations, using a specific
Create a BusRoute class that uses the Bus and Time class. This class will represent a bus route between two bus stations, using a specific Bus, and departing at a specific Time. It should contain a constructor, 7 instance variables (bus, bus number, cost, departure, duration, source, destination), and 9 methods (see below). [25 points] overloaded constructor: Creates a BusRoute object that is setup up with a Bus, a bus number, a cost, a departure Time, a duration time, a source BusStation, and a destination BusStation. getBus(): Returns the Bus that operates this bn rusoute. getNumber(): Returns the bus number as a String. getCost(): Returns the bus route cost. getDestination(): Returns the destination BusStation. getDeparture(): Returns the departure Time. getArrival(): Returns a Time object with the arrival time (computed from the departure time and duration). getSource(): Returns a Bus Station object for the departure location. toOverviewString(): Returns a String representing an overview of the bus route. Use NumberFormat to display the price. See the sample output for an example. toDetailedString(): Returns a String representing the bus route's detailed information. See the sample output for an example. Included below is an overall UML diagram that describes the three classes you will be constructing. It provides a useful summary of all of the methods you are expected to implement, and their corresponding types and visibility. Notice that one private method is listed here (formatDigits in Time) that isn't mentioned above. This is a method that was in our solution, you may not need it in your answer. Conversely, you may implement additional private methods that you find useful.
Bus type BusType Bus (b Bus Type) getBus Type() Bus Type toString0: String association Bus Bus Route bus Bus number String cost double departure Time duration int Bus Time hour int minute int Time Time(h: int, m: int) getHour nt getMinute nt addHours (h int void addMinutes (m nt void add Time (other :Time) void get Copy() Time isEarlier Than other Time) boolean ISSamelime other Time) boolean isLater Than (other Time): boolean forma Digits nt): String toString String associationStep by Step Solution
There are 3 Steps involved in it
Step: 1
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