Question: Reference class Write a reference class called CTATrain that models information about a CTA L train making its run. The instance variables should contain information

 Reference class Write a reference class called CTATrain that models information

Reference class Write a reference class called CTATrain that models information about a CTA "L" train making its run. The instance variables should contain information about the trains: run number, an integer: line color, a string containing one of the values "red", "green", "blue", "purple", "brown", "pink", "orange", or "yellow": next station, a string containing the name of the station it will next arrive at: arrival time, a string of the form "hh:mm:ss" indicating when it is expected to arrive at that station. The API consists of: a four-parameter constructor: individual methods for retrieving the value of each instance variable (i.e., accessor methods). For example, the signature of the one retrieving the line color will be public string getLineColor() tostring () method that produces a string looking like this:[brown, 421, Rockwell 13:34:54 >, where the values are the line color, run number, next station, and arrival time: compareTo (CTATrain that) method that compares CTA train objects based on their run number, which means you should define the class so that CTATrain objects are comparable. The test program has been written to read data from the file CTAdata.txt. Place this in your data folder in Eclipse. The test program then sorts an array list of trains in a couple of different ways, each time printing the list

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!