LOL
Well how bout this.......how bout I just change the parameters for each method?
Instead of lets say first class in the for loop where int i = 0 and then i > 3.....i make it i > 2?
And then do the same thing for all of the other methods?

Yes, you can say that first class is from 0-2 instead of 1-3 and so on, it's a good solution.

Now for the thing where if all of the classes are full it tells the user to take another flight.....how would I do that? I mean it is all in different methods......I can't make a method that uses all of those methods right? OR perhaps a boolean method that uses all of those methods? Doesn't it become too complicated and confusing?

First try to implement something that works. Then we will see if indeed it is confusing and can be simplified.

Ok I added the necessary code and new boolean and options in my if else in each case.
What do you guys think?

import java.util.*;
public class airlineReservation
{
  public static final int MAX_COLUMN = 4;
  public static final int MAX_ROW = 20;

  public static void main(String[] args)
  {
    
    int[][] totalSeats = new int[MAX_ROW][MAX_COLUMN];
    
    Scanner input = new Scanner(System.in);
    
    displayMenu();
    int menuChoice;
    menuChoice = input.nextInt();
    while (menuChoice < 6)
    {
    switch(menuChoice)
    {
      case 1:
        System.out.println("You have Chosen First Class!");
        if (!isFirstClassFull(totalSeats))
        {
        makeFirstReservation(totalSeats,input);
        }
        else if(!isAllFull(totalSeats))
        {
          System.out.println("This Class is Full Please Choose Another Class");
        }
        else
        {
          System.out.println("Flight is Full.....Another Flight Will Be Leaving in 3 Hours!");
        }
        displayMenu();
        menuChoice = input.nextInt();
        break;
      case 2:
        System.out.println("You have Chosen Business Class!");
        if (!isBusinessClassFull(totalSeats))
        {
        makeBusinessReservation(totalSeats,input);
        }
        else if (!isAllFull(totalSeats))
        {
          System.out.println("Business Class is Full Please Choose Another Class");
        }
        else
        {
          System.out.println("Flight is Full.....Another Flight Will Be Leaving in 3 Hours!");
        }
        displayMenu();
        menuChoice = input.nextInt();
        break;
      case 3:
        System.out.println("You have Chosen Economy Class!");
        if (!isEconomyClassFull(totalSeats))
        {
        makeEconomyReservation(totalSeats,input);
        }
        else if (!isAllFull(totalSeats))
        {
          System.out.println("Economy Class is Full Please Choose Another Class");
        }
        else
        {
          System.out.println("Flight is Full.....Another Flight Will Be Leaving in 3 Hours!");
        }
        displayMenu();
        menuChoice = input.nextInt();
        break;
      case 4:
        System.out.println("You have Chosen to Display All Available Seating!");
        displayArray(totalSeats);
        displayMenu();
        menuChoice = input.nextInt();
        break;
      case 5:
        System.out.println("You have Chosen to Quit the Program!");
        break;
      }
    }
  }
  public static void makeFirstReservation(int[][] totalSeats, Scanner input)
  {
    for (int row = 0; row < 3; row++)
    {
      for (int col = 0; col < 4; col++)
    {
        if (totalSeats[row][col] == 0)
        {
          totalSeats[row][col] = 1;
          System.out.println("You have been assigned a First class seat " + col + " in row " + row);
          return;
        }      
      }
    }
  }
  public static void makeBusinessReservation(int[][] totalSeats, Scanner input)
  {
    for (int row = 3; row < 7; row++)
    {
      for (int col = 0; col < 4; col++)
      {
      if (totalSeats[row][col] == 0)
        {
          totalSeats[row][col] = 1;
          System.out.println("You have been assigned a Business class seat " + col + " in row " + row);
          return;
        }
      }
    }
  }
  public static void makeEconomyReservation(int[][] totalSeats, Scanner input)
  {
    for (int row = 7; row < 20; row++)
    {
      for (int col = 0; col < 4; col++)
      {
      if (totalSeats[row][col] == 0)
        {
          totalSeats[row][col] = 1;
          System.out.println("You have been assigned an Economy class seat " + col + " in row" + row);
          return;
         }
       }
      }
    }
  public static boolean isFirstClassFull(int[][] totalSeats)
  {
   for (int row = 0; row < 3; row++) 
     {
      for (int col = 0; col < 4; col++) 
        {
         if (totalSeats[row][col] == 0) 
            return false;
      }
    }
   return true;
  }
  public static boolean isBusinessClassFull(int[][] totalSeats)
  {
    for (int row = 4; row < 7; row++)
    {
      for (int col = 0; col < 4; col++)
      {
        if (totalSeats[row][col] == 0)
          return false;
      }
    }
    return true;
  }
  public static boolean isEconomyClassFull(int[][] totalSeats)
  {
    for (int row = 8; row < 20; row++)
    {
      for (int col = 0; col < 4; col++)
      {
        if (totalSeats[row][col] == 0)
              return false;
      }
    }
    return true;
  }
  public static boolean isAllFull(int[][] totalSeats)
  {
    for (int row = 0; row < 20; row++)
    {
      for (int col = 0; col < 4; col++)
      {
        if (totalSeats[row][col] == 0)
          return false;
      }
    }
    return true;
  }
  public static void displayArray(int[][] totalSeats)
  {
    for (int row = 0; row < totalSeats.length; row++)
    {
      for (int col = 0; col < totalSeats[row].length; col++)
      {
        System.out.print(totalSeats[row][col]);
      }
      System.out.println();
    }
  }
  public static void displayMenu()
  {
    System.out.println("Welcome to Never Crash Airlines");
    System.out.println("We almost hardly ever crash!");
    System.out.println("Below are our menu options for picking flights and checking which classes are open");
    System.out.println("Choose and Option 1-5!");
    System.out.println("1. First Class");
    System.out.println("2. Business Class");
    System.out.println("3. Economy Class");
    System.out.println("4. Display All Available Seats!");
    System.out.println("5. Quit!");
  }
}

If all the plane is full, perhaps you want to exit the program and not display the reservation menu again?

Oh yea good call.....how do I do that?
I tried System.exit(0); a while ago and it never seemed to work.

System.exit(n); should definitely work to exit the program. If it didn't work before, you might have put it in the wrong place.

By the way, your isAllFull method is fine the way it is, but you guessed correctly that you could have used your existing methods to see if the plane is full like this:

public static boolean isAllFull(int[][] totalSeats) {
   return isFirstClassFull(totalSeats) &&
          isBusinessClassFull(totalSeats) &&
          isEconomyClassFull(totalSeats);
}

don't you have to call those methods in the argument parenthesis for it to work that way?

The methods are visible throughout the class, the members have their scope meaning that their visibility is depending on where they were created.

Oh cool so it is just a positioning thing so as long as it at the end of the program.

No, it doesn't have to be at the end of the program. It just has to be reachable.

In Java the order of the methods does not matter - inside the class all the methods are visible and outside of it it depends on the modifier (public, private etc')

Awesome thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.