Question: I've been trying for two days, but I can't wrap my mind around ArrayLists to solve this Intro to Computer Science question using JAVA. Can

I've been trying for two days, but I can't wrap my mind around ArrayLists to solve this Intro to Computer Science question using JAVA. Can you please help me?

I created a class called CTAStation that holds information for each train station, and that is working fine. My problem arises when I need to create a new class called CTARoute that encapsulates an ArrayList of CTAStation. Im having trouble getting my mind around what I need to do because I dont know how to implement the ArrayList class and I get confused when trying to build the default and non-default constructor. I dont know what would be the passed variables for the non-default constructor, etc.

Here is the full question for the problem (I included the data at the end of the question):

In this assignment, you will write a user-defined class that will encapsulate an ArrayList of CTAStations called CTARoute You will allow users to look up stations by name, add new stations, and delete existing stations.

I've been trying for two days, but I can't wrap my mind this is the UML for the CTARoute class. I understand how to create getters and setters for normal classes, but not for the ArrayList. I need help with this. In addition, the classes need to have a toString() and equal() method which I dont know how to do for CTARoute because of the ArrayList

To clarify things, the UML for the class GeoLocation and class CTAStation I created is the following (CTAStation extends the GeoLocation class and I've already created these two classes)::

around ArrayLists to solve this Intro to Computer Science question using JAVA.

In addition, I'm having trouble understanding if CTARoute extends any of the two classes I've already created, or if it is a stand alone class.

After creating the CTARoute class, create an application class for the user. This application needs to have a menu like this:

1. Display the names of all stations 2. Display the stations with wheelchair access 3. Display the nearest station to a location 4. Display information for a station with a specific name 5. Display information for all stations 6. Add a new station 7. Delete an existing station 8. Exit

The following are suggestions of how to create the methods for the CTARoute class:

- Adding a station should ask for each instance variable individually as well as the name of the route that the station is on - Adding a station should ask for the names of the previous and following stations and insert the new station into the correct position - Removing an existing station needs to ask for the name of the station and the route (or routes) that it appears on.

Anyway, if you made it this far, I appreciate your time for trying to help me. Here is the data from a file called "CTAStops.csv" for the objects of CTAStation:

Name,Latitude,Longitude,Location,Wheelchair,Red,Green Harlem,41.88706,-87.80486,elevated,TRUE,-1,0 Oak Park,41.886784,-87.794324,elevated,FALSE,-1,1 Ridgeland,41.886784,-87.784628,elevated,FALSE,-1,2 Austin,41.887293,-87.774135,elevated,FALSE,-1,3 Central,41.887389,-87.76565,elevated,TRUE,-1,4 Laramie,41.887163,-87.754986,elevated,TRUE,-1,5 Cicero,41.886519,-87.744698,elevated,TRUE,-1,6 Pulaski,41.885412,-87.725404,elevated,TRUE,-1,7 Conservatory-Central Park Drive,41.884904,-87.716513,elevated,TRUE,-1,8 Kenzie,41.884321,-87.706155,elevated,TRUE,-1,9 California,41.88422,-87.696234,elevated,TRUE,-1,10 Ashland,41.885268,-87.666969,elevated,TRUE,-1,11 Morgan,41.8856,-87.6522,elevated,TRUE,-1,12 Clinton,41.885678,-87.641782,elevated,TRUE,-1,13 Clark/Lake,41.885767,-87.630885,elevated,TRUE,-1,14 State/Lake,41.88574,-87.627835,elevated,FALSE,-1,15 Randolph/Wabash,41.884431,-87.626149,elevated,FALSE,-1,16 Adams/Wabash,41.884431,-87.6261,elevated,FALSE,-1,17 Roosevelt,41.867368,-87.627402,elevated/subway,TRUE,23,18 Cermak-McCormick,41.8531548,-87.626423,elevated,TRUE,-1,19 35th-Bronzeville-IIT,41.831677,-87.625826,elevated,TRUE,-1,20 Indiana,41.821732,-87.621371,elevated,TRUE,-1,21 43rd,41.816462,-87.619021,elevated,TRUE,-1,22 47th,41.8094,-87.61909,elevated,TRUE,-1,23 51st,41.8022,-87.61903,elevated,TRUE,-1,24 Garfield,41.79454,-87.61835,elevated,TRUE,-1,25 47th,41.810318,-87.63094,surface,TRUE,26,-1 63rd,41.780536,-87.630952,surface,TRUE,28,-1 69th,41.768367,-87.625724,surface,TRUE,29,-1 79th,41.750419,-87.625112,surface,TRUE,30,-1 87th,41.735372,-87.624717,surface,TRUE,31,-1 95th/Dan Ryan,41.722377,-87.624342,surface,TRUE,32,-1 Addison,41.947428,-87.653626,elevated,TRUE,12,-1 Argyle,41.973453,-87.65853,embankment,FALSE,8,-1 Belmont,41.939751,-87.65338,elevated,TRUE,13,-1 Berwyn,41.977984,-87.658668,embankment,FALSE,7,-1 Bryn Mawr,41.983504,-87.65884,embankment,FALSE,6,-1 Cermak-Chinatown,41.853206,-87.630968,elevated,TRUE,24,-1 Chicago,41.896671,-87.628176,subway,TRUE,17,-1 Clark/Division,41.90392,-87.631412,subway,TRUE,16,-1 Fullerton,41.925051,-87.62866,elevated,TRUE,14,-1 Garfield,41.79542,-87.631157,surface,TRUE,27,-1 Grand,41.891665,-87.628021,subway,TRUE,18,-1 Granville,41.993664,-87.659202,embankment,TRUE,4,-1 Harrison,41.874039,-87.627479,subway,FALSE,22,-1 Howard,42.019063,-87.672892,embankment,TRUE,0,-1 Jackson,41.878153,-87.627596,subway,TRUE,21,-1 Jarvis,42.015876,-87.669092,embankment,FALSE,1,-1 Lake,41.884809,-87.627813,subway,TRUE,19,-1 Lawrence,41.969139,-87.658493,embankment,FALSE,9,-1 Loyola,42.001073,-87.661061,embankment,TRUE,3,-1 Monroe,41.880745,-87.627696,subway,FALSE,20,-1 Morse,42.008362,-87.665909,embankment,FALSE,2,-1 North/Clybourn,41.910655,-87.649177,subway,FALSE,15,-1 Sheridan,41.953775,-87.654929,elevated,FALSE,11,-1 Sox-35th,41.831191,-87.630636,surface,TRUE,25,-1 Thorndale,41.990259,-87.659076,embankment,FALSE,5,-1 Wilson,41.964273,-87.657588,elevated,FALSE,10,-1

CTA Route -name: String -stops: AmayListcCTAStationD +addStation(CTAStation): void +removestation(CTAStation): void insertStation(int CTAStation): void HookupStation(String): CTAStation +nearest Station(double, double): CTAStation neareststation(GeoLocation): CTAStation the previous lab, you only need to con

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!