Hey there!
I'm working on specific method (reserve a plane seat), and I have created a 2D array to represent the seats. here is the method so far to reserve a seat in economy class:
public static void reserveEC(int x[][]){ for (int i=0;i<15;i++){ for (int j=0;j<6;j++) { if (x[i][j] == 0) { x[i][j] = 1; break; } } } }
The problem is, I want it to find the next available seat, and set it to 1 (which I'm going to make mean "taken").
I keep getting the output :
100000
100000
100000
100000
100000
100000
100000
100000
100000
100000
100000
100000
100000
100000
100000
and I only want ONE seat to be set to 1 in my 15 x 6 array... any suggestions?