SER 200 Demonstrates Something Great/tutorialoutletdotcom SER 200 Demonstrates the use of the Bus Class | Page 2
isEarlierThan(...): Returns true if this Time object is earlier than
another Time object.
isSameTime(...): Returns true if this Time object is the same as
another Time object.
isLaterThan(...): Returns true if this Time object is later than another
Time object.
toString(): Returns a string representing the Time object. Uses 12
hour AM/PM format and pads minutes to be two digits. See the
sample output for an example.
Q5: 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.