package Lect42Review; // Idea: This program is used to organize people in tables of a restaurant. // Each table is represented by an instance of the Table class. // The collection of tables is represented by a two-dimensional array // of Table objects. Each array row represents a section of the restaurant // and a row number corresponds to a section number. For simplicity // section and table numbers start at 0. Each section can have a diffrent // number of tables. // // Reviews: two-dimensional arrays of objects, ArrayList, Composition, // break/label, iterator public class TableSeatingChart { private Table[][] tables; private int maxPeoplePerTable; public TableSeatingChart(int maxPeoplePerTable) { tables = new Table[0][]; this.maxPeoplePerTable = maxPeoplePerTable; } public int addSection(int numberOfTables) { // Expand the number of sections by creating new // array of references to Table objects and copying // over references to previous sections int origNumSections = tables.length; Table[][] newTables = new Table[origNumSections + 1][]; for (int sectionNum=0; sectionNum