public class BoeingSeatMap extends SeatMap{
public BoeingSeatMap() {
this.seats= new Seat[nRows][nColumns] ;
this.nColumns=7;
this.nRows=10;
this.nFirstClassRows=4;
initialiseSeatMap();
}
protected void initialiseSeatMap() {
String str="ABCDEFG";
for (int i=0;i<nRows;i++) {
seats[i][0].getSeatPostion().setRow(i+1);
seats[i][0].getSeatPostion().setColumn(str.charAt(0));
seats[i][0].setSeatType(SeatType.WINDOW);
seats[i][nColumns-1].getSeatPostion().setRow(i+1);
seats[i][nColumns-1].getSeatPostion().setColumn(str.charAt(6));
seats[i][nColumns-1].setSeatType(SeatType.WINDOW);
if (i<=4) {
seats[i][0].setFirstClass(true);
seats[i][nColumns-1].setFirstClass(true);
}
}
Just wondering why this would return a ArrayIndexOutOfBoundsException when I am trying to store into a part of the 2d array that shouldnt be out of bounds eg [1][6]