Question: CPSC-4355 ArrayList Assignment Demonstrate defining, loading, printing and storing a Multidimensional ArrayList. Just as the elements of an array can be defined to be arrays

CPSC-4355 ArrayList Assignment Demonstrate defining, loading, printing and storing a Multidimensional ArrayList. Just as the elements of an array can be defined to be arrays themselves (thus making multidimensional arrays), so can an ArrayList be defined to contain elements that are themselves an ArrayList (thus making multidimensional ArrayLists). 1. Define a multidimensional ArrayList named seats to hold the status (available, taken) of seats in a theatre. a. There are three dimensions i. The seating levels (main floor, 1st balcony, 2nd balcony). ii. The rows on a given level. iii. The seats in a given row. iv. Define seats as an ArrayList of levels where each level is an ArrayList of rows and each row is an ArrayList of seats (thus the 3 dimensions). b. Since the status can only be two values, the data type is Boolean. 2. Initialize the ArrayList so that all seats are taken except the first seat of each row. a. True = seat is taken; false = seat is available 3. Display the ArrayList by seating level on screen. 4. Store the ArrayList by seating level to a file using PrintStream (recall from section 6.4 in book). CPSC-4355 ArrayList Assignment NOTE that the new command syntax allows the right side to get the data type from the left side of the statement without repeating it: ArrayList variableName = new ArrayList<>(); NOTE that since the ArrayList does not have predetermined sizes, the dimensions for the seating layout must be stored someplace. Use the following 2-dimensional array to hold the rows and seats for each seating level of the theatre. int [][] seatsLayout = {{4,5}, // rows and seats on the main floor {3,4}, // rows and seats on the 1st balcony {1,3}}; // rows and seats on the 2nd balcony Output to the screen and file should look as follows: [[false, true, true, true, true], [false, true, true, true, true], [false, true, true, true, true], [false, true, true, true, true]] [[false, true, true, true], [false, true, true, true], [false, true, true, true]] [[false, true, true]]

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!