//Constructor, create a Seat class/object in each position in the array and count totalseats public SeatManager() { for (int x = 0; x < book.GetLength(0); x++) { for (int y = 0; y < book.GetLength(1); y++) { book[x, y] = new Seat(x, y); } } setTotalSeat(); }
//method used to return all rows in array public Seat[] getAll() { Seat[] returnResults = new Seat[320]; int count = 0; for (int x = 0; x < book.GetLength(0); x++) { for (int y = 0; y < book.GetLength(1); y++) { returnResults[count] = book[x, y]; count++; } } return returnResults; }
//Method used to check if a certin row is booked public Seat getResveration(int row, int seat) { Seat[] returnResults = new Seat[320]; Seat reservationStatus = book[0,0]; for (int x = 0; x < book.GetLength(0); x++) { for (int y = 0; y < book.GetLength(1); y++) { if (row == x && seat == y) { reservationStatus = book[x, y]; } } } return reservationStatus; }
//Method used to return all reserved rows public Seat[] getResverations() { Seat[] returnResults = new Seat[320]; int count = 0; for (int x = 0; x < book.GetLength(0); x++) { for (int y = 0; y < book.GetLength(1); y++) { if (book[x, y].isBooked()) { returnResults[count] = book[x, y]; count++; } } } return returnResults; }