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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
