It's an Airline reservation system, basically taking a row of 10 seats, 1 isle, 1 window. Yes, there's only one row. xD So 5 seats isle, 5 seats window.. Here's the code I have so far:
package airlineconsole;
import java.io.*;
public class Main
{
private static BufferedReader stdin = new BufferedReader(
new InputStreamReader( System.in ) );
/** Creates a new instance of Main */
public Main()
{
}
public static void main(String[] args) throws IOException
{
// Init
boolean[][] array = new boolean[5][5];
// end Init
System.out.println("Welcome! Please enter the style seating(1 for Economy, 2 for First Class): ");
String seatStyle = stdin.readLine();
int seatStyleNum = Integer.parseInt( seatStyle );
for (int i=0;i<5;i++)
for (int j=0;j<2;j++)
{
while ((array[i][j]) == false)
{
System.out.println("Seat " +array[i][j]+ " Reserved.");
array[i][j] = true;
}
}
}
}
My problem is, this goes through the entire array, and prints out EVERY seat. But I don't understand why it's doing that, since I set the value to TRUE after the fact?


Sign In
Create Account


Back to top









