Question: agile coding Question 2. (3+(1.25 +1.75) =6 marks) In Java, Abstract Data Types can be used to store collections of data. Abstract Data Types include

agile coding
agile coding Question 2. (3+(1.25 +1.75) =6 marks) In Java, Abstract Data

Question 2. (3+(1.25 +1.75) =6 marks) In Java, Abstract Data Types can be used to store collections of data. Abstract Data Types include Lists. A concrete java class that implements a List is an ArrayList. Arrays can also be used to create a group of like objects into an Array data structure. a) Assume you have a collection of data objects representing train services, including their departure station, arrival station and scheduled day and time for departure. Show the java code that would create either an ArrayList or an Array to create a collection of 'TrainService' objects in the reference variable allTrain Services. The code should declare a reference variable named allTrainServices and allocate memory for storing references of up to 150 services. [3 marks] b) Each TrainService object will have a serviceNumber (int), serviceDay (String) and departure Time (double) and two (2) associated Station objects that contains all the data for the departure and arrival train stations. These Station objects will be referred to in each TrainService object as departure Station and arrivalStation. i. List the class attributes for the TrainService class (1.25 marks) and ii. Write the 4 lines of Java code that would declare these attributes in the TrainService.java file. [1.75 marks]

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!