Hi folks
I know this particular program has been posted in many other forums but it all involves many different things that I have no learned yet so I really can't use any of them.....plus it would make me look stupid to turn in something that I copied that includes code that is beyond my understanding.....and also pretty obvious as well.
Anyway this is the airplane reservation program involving 2D arrays which seems to be a teacher favorite apparently from all the other forums posts on different web sites. I had thought that I was on the right track with getting this program done and working but apparently I had jumped the gun on that thought process.
Anyways here goes the explanation of what I was attempting to do. The total seats on my reservation 2D should be 80.......20 rows and 4 columns. And I am using a menu system where 1 is First class which is rows 1-3 and then option 2 is rows 4-7 and then option 3 is rows 8-20 all broken into different classes of seating which you will see from my program. And then option 4 will display all available seats.
Now when a customer makes a reservation the program will give them a boarding pass with the row and column and class type. If the class is full it will tell the user and make them enter another seating.....if the entire 80 seats are full it will alert the user and then tell them to take another flight.
Ok so the 2D array needs to be initialized to zero seats taken and then when a seat is taken it needs to set that element to 1 to show that it is taken. It should never be able to assign a seat that is already taken aka double booking lol
Here is my code so far:

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);
    
    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!");
    
    int menuChoice;
    menuChoice = input.nextInt();
    
    switch(menuChoice)
    {
      case 1:
        System.out.println("You have Chosen First Class!");
        makeFirstReservation(totalSeats,input);
        break;
      case 2:
        System.out.println("You have Chosen Business Class!");
        makeBusinessReservation(totalSeats,input);
        break;
      case 3:
        System.out.println("You have Chosen Economy Class!");
        makeEconomyReservation(totalSeats,input);
        break;
      case 4:
        System.out.println("You have Chosen to Display All Available Seating!");
        displayArray(totalSeats);
        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++)
    {
      row = input.nextInt();
      col = input.nextInt();
      System.out.println(totalSeats[row][col]);
    }
  }
  public static void makeBusinessReservation(int[][] totalSeats, Scanner input)
  {
    for (int row = 3; row < 7; row++)
      for (int col = 0; col < 4; col++)
      totalSeats[row][col] = input.nextInt();
  }
  public static void makeEconomyReservation(int[][] totalSeats, Scanner input)
  {
    for (int row = 7; row < 20; row++)
      for (int col = 0; col < 4; col++)
      totalSeats[row][col] = input.nextInt();
  }
  /*public static boolean isFirstclassFull(int[][] totalSeats)
  {
    boolean result;
    if (row < 3)
      result = true;
    else
      result = false;
    return result;
  }
  public static boolean isBusinessclassFull(int[][] totalSeats)
  {
    boolean result;
    if ((row > 3)&&(row < 7))
      result = true;
    else
      result = false;
    return result;
  }
  public static boolean isEconomyclassFull(int[][] totalSeats)
  {
    boolean result;
    if ((row > 8)&&(row < 20))
      result = true;
    else
      result = false;
    return result;
  }*/
    
  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.printf("%7d",totalSeats[row][col]);
    System.out.println();
  }
  
}

This program needs to be simple and at my own skill level which I have attempted to do. But I have been deleting and adding things like mad. This program is really frustrating me to no end it seems. MY menu system for instance just keeps asking me over and over to enter numbers lol and when I choose print the array is prints a whole bunch of unorganized characters.
TEAR THIS PROGRAM APART! lol be brutal and let me know what dumb things I am doing wrong and how to do it the right way please.....don't be afraid to totally bash what I have done so far I know my coding skills aren't that great.

First you need to get your menu working in a loop:
On line 20 put boolean done = false; . Then between lines 21 & 22, put while (!done) { . Then between lines 43 & 44 put done = true; . Then between lines 45 & 46 put another close curly brace.

When a person wants to make a 1st class reservation, is that all they need to say, or are they supposed to pick a seat? In your makeFirstReservation method, you are using the scanner to get more user input. If you want the user to pick a seat, I would guess you need to tell them what seats are still available in first class. Otherwise, you could just have the program assign the next available seat and not ask the user to pick one. So it depends on how you want the program to work.

I guess they could just take whatever seat.....it doesn't matter whether they pick the seat or not it just can't allow them to take a seat that is already taken.

I really am having a hard time in putting things into 2D elements through user input I guess......perhaps that is my issue I am not sure.

Right. I think it would be easier for the program to assign a seat to the user, rather than asking the user to pick a seat. So you don't need to pass the Scanner into makeFirstReservation.

You wrote a nested for loop - that's good. What you need to do inside that loop is check if (totalSeats[row][col] == 0) , and if it does, then tell the user s/he can have the seat in that row/col, and assign totalSeats[row][col] = 1; so that next time you check, you will see that seat is taken.

Let's take a look at makeFirstReservation method:

public static void makeFirstReservation(int[][] totalSeats, Scanner input)
{
   for (int row = 0; row < 3; row++)
   {
      for (int col = 0; col < 4; col++)
      {
         row = input.nextInt();
         col = input.nextInt();
         System.out.println(totalSeats[row][col]);
      }
  }
}

Every iteration of the inner loop you are asking the user again for row and col, and then print the number inside that specific 2d array cell - not exactly what you wanted. You want the user to decide where he wants to sit, and then you want to check if you have any sits left. Let's assume that the user chose first class. You want to go over the matrix cells until you encounter an open sit (the first cell with 0) - if there is such a cell, then success, the user have a boarding pass and you need to change that cell to 1, otherwise the user will be back to the menu to choose another class.
So in the makeFirstReservation method we basically want to check if there is a cell with value 0 in the range of the first 3 rows, all four columns. We will use a boolean variable to tell us whether there is an empty sit or not - we will scan the matrix, and when (and if) we will find an empty sit, then the variable will be equal to true:

public static void makeFirstReservation(int[][] totalSeats, Scanner input)
{
   boolean emptySit = false;
   for (int row = 0; row < 3; row++)
   {
      for (int col = 0; col < 4; col++)
      {
         if(totalSeats[row][col] == 0)
         {
            emptySit = true;
         }
      }
  }
  if(emptySit)
  {
     //we have an empty sit, make the reservation - assign the cell to 1.
  }
  else
  {
     //no empty sit, need to choose another class.
  }
}

Another approach will be to make a method that will tell us if there is an empty in the first class, and will return to us true or false acoordinly. This will be useful if you want to make the reservation process / asking the user again for a class if there is no sit in another class:

public static void makeFirstReservation(int[][] totalSeats, Scanner input)
{
   boolean emptySit = false;
   for (int row = 0; row < 3; row++)
   {
      for (int col = 0; col < 4; col++)
      {
         if(totalSeats[row][col] == 0)
         {
            emptySit = true;
         }
      }
  }
  return emptySit; //return the result
}

Try to implement the rest of the classes, decide how you want to handle the reservation and the case where the class is full.

apines, in order for this approach of setting a boolean to work, you need to put a break statement just after setting the boolean to true inside the loop. Otherwise it can just get set to false again in a different loop iteration and you won't have the value you want at the end.

Also, in your second code snippet, you have a void method that returns a boolean value.

I do have separate boolean methods for determining whether a certain seating class is full or not if that helps lol

apines, in order for this approach of setting a boolean to work, you need to put a break statement just after setting the boolean to true inside the loop. Otherwise it can just get set to false again in a different loop iteration and you won't have the value you want at the end.

Also, in your second code snippet, you have a void method that returns a boolean value.

Well, you are right about the void method returning a boolean, but I don't need a break since the boolean is set to false at the beginning and set to true if there is an empty sit. Can we settle on just half my bad and not a full one? :) I didn't put the break statement because it can confuse and this is not the point of the explanation :)
The method should be public static boolean makeFirstReservation(int[][] totalSeats, Scanner input)

the reservation methods for each class shouldn't be boolean though. As you can see from my code I do have boolean methods that check whether the class is full or not. They are commented out because they wouldn't work or let me compile.
My program is so messed up....well....at least how retarded my code is nobody can accuse me of copying and pasting code LOL!

Here is the updated full code
I still don't think the reservation system works out because I chose only a few seats from each section and when I chose option 4 it printed out 1's for each element.

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!");
        System.out.println("Reserve a Seat");
        makeFirstReservation(totalSeats,input);
        displayMenu();
        menuChoice = input.nextInt();
        break;
      case 2:
        System.out.println("You have Chosen Business Class!");
        System.out.println("Reserve a Seat");
        makeBusinessReservation(totalSeats,input);
        displayMenu();
        menuChoice = input.nextInt();
        break;
      case 3:
        System.out.println("You have Chosen Economy Class!");
        System.out.println("Reserve a Seat");
        makeEconomyReservation(totalSeats,input);
        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();
    }
  }
  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;
      }
      }
    }
  }
  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;
      }
      }
    }
  }
  /*public static boolean isFirstclassFull(int[][] totalSeats)
  {
    boolean result;
    if (row < 3)
      result = true;
    else
      result = false;
    return result;
  }
  public static boolean isBusinessclassFull(int[][] totalSeats)
  {
    boolean result;
    if ((row > 3)&&(row < 7))
      result = true;
    else
      result = false;
    return result;
  }
  public static boolean isEconomyclassFull(int[][] totalSeats)
  {
    boolean result;
    if ((row > 8)&&(row < 20))
      result = true;
    else
      result = false;
    return result;
  }*/
    
  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("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!");
  }
}

And I was also thinking if I ever can get my boolean methods working they would most likely need to go in each of the class options most likely before the user input for reserving a seat correct?

In your make reservation methods, after setting one location in the totalSeats array to 1 you need to break out of the loop. Otherwise you are setting every location in the array to 1.

break out of the loop in the actual method? how do I do that? I know to include break; statements in my menu but that's about it.

In a loop you can use the keyword continue to stop the current loop iteration and proceed to the next one, and the keyword break that simply exits the loop.

Well if you don't need to do anything inside the method after that, you can just put a return statement. But if you want to tell the user what seat s/he has been assigned, or do something else in the method after making the seat assignment, you need to use a break statement with a label, since you are breaking out of 2 nested loops.

outside:     // this is a label
   for (int row = 0; row < 3; row++) {
      for (int col = 0; col < 4; col++) {
         if (totalSeats[row][col] == 0) {
            totalSeats[row][col] = 1;
            break outside;    // this will cause execution to continue on line 10.
         }  // end of if
      }  // end of column loop
   }  // end of row loop
   // do more stuff here

Hmm....well I did that and I chose all 3 classes twice and it game me this kind of print out:
1111
0000
0000
1111
0000
0000
0000
1111
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
If I only chose each class twice than why is it 4 seats in each class are taken up?

Don't know without looking at the code.

What happens if you just choose first class once?

Here is the code:

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!");
        System.out.println("Reserve a Seat");
        makeFirstReservation(totalSeats,input);
        displayMenu();
        menuChoice = input.nextInt();
        break;
      case 2:
        System.out.println("You have Chosen Business Class!");
        System.out.println("Reserve a Seat");
        makeBusinessReservation(totalSeats,input);
        displayMenu();
        menuChoice = input.nextInt();
        break;
      case 3:
        System.out.println("You have Chosen Economy Class!");
        System.out.println("Reserve a Seat");
        makeEconomyReservation(totalSeats,input);
        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;
        }
          
    }
      break;
    }
  }
  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;
      }
      }
      break;
    }
  }
  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;
      }
      }
      break;
    }
  }
  /*public static boolean isFirstclassFull(int[][] totalSeats)
  {
    boolean result;
    if (row < 3)
      result = true;
    else
      result = false;
    return result;
  }
  public static boolean isBusinessclassFull(int[][] totalSeats)
  {
    boolean result;
    if ((row > 3)&&(row < 7))
      result = true;
    else
      result = false;
    return result;
  }
  public static boolean isEconomyclassFull(int[][] totalSeats)
  {
    boolean result;
    if ((row > 8)&&(row < 20))
      result = true;
    else
      result = false;
    return result;
  }*/
    
  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("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!");
  }
}

regardless of what option I choose it loops the menu
I suppose I should have something in there that tells the user they have reserved a seat and where the seat is.

Lines 66, 80, 94 - the break statement is in the wrong place. Look again at the code I posted above for breaking out of a nested loop.

Ok I fixed the break statements but I am still not getting the right results. That and I still can't get my booleans to work to check if the sections are full so I am just leaving them commented out...they are needed to for the program to be complete however.

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!");
        System.out.println("Reserve a Seat");
        makeFirstReservation(totalSeats,input);
        displayMenu();
        menuChoice = input.nextInt();
        break;
      case 2:
        System.out.println("You have Chosen Business Class!");
        System.out.println("Reserve a Seat");
        makeBusinessReservation(totalSeats,input);
        displayMenu();
        menuChoice = input.nextInt();
        break;
      case 3:
        System.out.println("You have Chosen Economy Class!");
        System.out.println("Reserve a Seat");
        makeEconomyReservation(totalSeats,input);
        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;
          break;
        }
          
    }
    }
  }
  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;
          break;
      }
      }
    }
  }
  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;
          break;
         }
       }
      }
    }
  /*public static boolean isFirstclassFull(int[][] totalSeats)
  {
    boolean result;
    if (row < 3)
      result = true;
    else
      result = false;
    return result;
  }
  public static boolean isBusinessclassFull(int[][] totalSeats)
  {
    boolean result;
    if ((row > 3)&&(row < 7))
      result = true;
    else
      result = false;
    return result;
  }
  public static boolean isEconomyclassFull(int[][] totalSeats)
  {
    boolean result;
    if ((row > 8)&&(row < 20))
      result = true;
    else
      result = false;
    return result;
  }*/
    
  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("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!");
  }
}

Your break is in the right place now, but without the label, it will only break out of the inner loop. Please read my post again about breaking out of a nested loop.

If I haven't learned it then I am not really able to use it bleh....never even gone over the use of labels and such which I guess is a shame because people are always offering all these awesome solutions and yet they are things I have never even been able to learn yet.

Well, then you have to use a return statement instead. Try this.

public static boolean makeFirstReservation(int[][] totalSeats) {
   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("Assigned seat " + col + " in row " + row);
            return true;  // this means a seat was assigned
         }
      }
   }
   // if you got here, that means there were no seats left to assign
   return false;
}

Now maybe you don't need those other boolean methods?

I think I would need all 3 specific ones for each class of seating.....I don't remember why I wanted that which is how much this code has changed since I started.....but I was thinking the way you see mine is that each one would be based on the rows available for each class....like first class is rows 1-3 and business is 4-7 and economy is 8-20.

Ok now the only problem is to find out where to stick the booleans.

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!");
        makeFirstReservation(totalSeats,input);
        System.out.println("You have Reserved a Seat in First Class!");
        displayMenu();
        menuChoice = input.nextInt();
        break;
      case 2:
        System.out.println("You have Chosen Business Class!");
        makeBusinessReservation(totalSeats,input);
        System.out.println("You have Reserved a Seat in Business Class!");
        displayMenu();
        menuChoice = input.nextInt();
        break;
      case 3:
        System.out.println("You have Chosen Economy Class!");
        makeEconomyReservation(totalSeats,input);
        System.out.println("You have Reserved a Seat in Economy Class!");
        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;
          break;
        }
          
    }
    }
  }
  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;
          break;
      }
      }
    }
  }
  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;
          break;
         }
       }
      }
    }
  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) 
           {
            totalSeats[row][col] = 1;
            System.out.println("You have been assigned a First class seat " + col + " in row " + row);
            return true;
         }
      }
    }
   return false;
  }
  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)
        {
          totalSeats[row][col] = 1;
          System.out.println("You have been assigned a Business class seat " + col + " in row " + row);
          return true;
        }
      }
    }
    return false;
  }
  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)
        {
              totalSeats[row][col] = 1;
              System.out.println("You have been assigned an Economy class seat " + col + " in row" + row);
              return true;
        }
      }
    }
    return false;
  }
            
          
    
  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("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!");
  }
}

I NEED my makeReservation methods for use and I NEED my booleans......But I am thinking that these two will clash or somehow be redundant or something. It just doesn't seem like they would match up very well with each other.

I've just combined two things in one method. It will both make the reservation and tell you whether there is a seat available or not. But this one is just for first class. You still need to implement something similar for business and economy.

If you don't want it to be a boolean method, then do this instead:

public static void makeFirstReservation(int[][] totalSeats) {
   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("Assigned seat " + col + " in row " + row);
            return;
         }
      }
   }
}

But now you won't know whether a seat was assigned or not.

You just took the make reservation code and put it in the is full method. That's not right. If you just want to check whether a section is full, then you shouldn't be assigning anything to 1.

Here's all you need to check if first class is full or not.

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;   // you found an empty seat
         }
      }
   }
   return true;   // no empty seats found
}

I was thinking in each option it could be like:

if(isFirstclassFul(totalSeats) = true)
{ 
makeReservation();
else
{
System.out.println("Class is full");
displayMenu();
menuChoice = input.nextInt();
}

or something like that.....my thought process on this started out pretty good but I think I lost myself.....this sounds good though right? I hope so ....lol

line 1 should either be

if (isFirstClassFull(totalSeats) == false)

or

if (!isFirstClassFull(totalSeats))

But if you look at the 2 methods isFirstClassFull and makeFirstClassReservation, you will see that they are almost identical. So a better way to do this is like this:

if (!makeFirstClassReservation(totalSeats)) {
   System.out.println("Class is full");
}
displayMenu();
menuChoice = input.nextInt();

Now you don't need 2 separate methods because one method does both things - it makes the reservation if there is space available, and it tells you if there is not any space left. If the method returns true, you don't have to do anything further. And if it returns false, then you know there aren't any seats left in that section.

Unfortunately I do need both methods.....not my stipulations but I do as I am told lol.
But I am guessing I can still use the if/else with the included boolean to still do the make method if its not full or return it is full if it is?

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.