I am trying to find the closest available seat.However ,I did try something but i could not find it ,so far after some formatting i came back to my star position.Any suggestions.!
public void nextFree(String seats) {
int colA = 0;
int rowA = Integer.parseInt(seats.substring(1, 2));
int newColB = 0;
int newRowB = 0;
if (seats.equalsIgnoreCase("a")) {
colA = 1;
} else if (seats.equalsIgnoreCase("b")) {
colA = 2;
} else if (seats.equalsIgnoreCase("c")) {
colA = 3;
} else {
colA = 4;
}
for (int i = 0; i < this.table.length; i++) {
for (int k = 0; k < this.table.length; k++) {
if (table[i][k] == "XX") {
newRowB = i;
newColB = k;
}
}
System.out.print("The seat " + colA + rowA + " is not available! The next availale is " + newColB + newRowB);
}
}