title: Make an Airline Program Loop Through All of Its Methods
body: <p>I am learning Java on my own and I am working through Deitel's book and am writing sample programs. </p>
  
  <p>Here is the exercise: </p>
  
  <p>A small airline has just purchased a computer for its new automated reservations system. You have been asked to develop the new system. You are to write an application to assign seats on each flight of the airline’s only plane (capacity: 10 seats).</p>
  
  <p>Your application will display the following alternatives: “Please type 1 for First Class” and “Please type 2 for Economy.” If the user types 1, your application will assign a seat in the first class section (seats 1–5). If the user types 2, your application will assign a seat in the economy section (seats 6–10). Your application will then display a boarding pass indicating the person’s seat number and whether it is in the first class or economy section of the plane.</p>
  
  <p>Use a 1 dimensional array of primitive type Boolean to represent the seating chart of the plane. Initialize all the elements of the array to false to indicate that all the seats are empty. As each seat is assigned, set the corresponding element of the array to true to indicate that the seat is no longer available.</p>
  
  <p>Your application will never assign a seat that has already been assigned. When the economy section is full, your application will ask the person if it is acceptable to be placed in the first class section (and vice versa). If yes, make the appropriate seat assignments. If no, display the message “Next flight leaves in 3 hours.”</p>
  
  <p>I am having trouble making the program to fully loop through all its arguments.</p>
  
  <p>Here is my code:</p>
  
  <pre><code> import java.util. Arrays;
   import java.util.Scanner;
  
   public class Exercise_619 {
  
       public static void main(String[] args){
  
           boolean [] seating = new boolean [11]; // Creates a one deminsional array
           Scanner input = new Scanner(System.in);
  
           System.out.println("Please type 1 for First Class or 2 for Economy: "); // Asks the user to give input
  
           int section = input.nextInt(); // Store user's input
  
           if (section == 1) // If the user inputs 1 for First class, then First Class object is called
           {
               firstClassSeat();
           }
  
           else // If the user inputs 2 for Economy, then Economy object is called
           {
               economySeat();
           }
  
       }
  
       public static void firstClassSeat(){
  
           boolean [] seating = new boolean [11]; // Creates a new array
           Scanner input = new Scanner(System.in);
  
           for (int count = 1; count &lt;= 5; count++){ // Starts the loop for First Class object
  
           if (seating[count] == false)
           {
  
               seating[count] = true; // Assigns passenger a seat in first class
               System.out.printf("First Class. Seat number: %d\n", count);
               break;
           }
  
           else if (seating[5] == true)
           {
  
           if (seating[10] == true) // If the psasenger does not decide to down grade to Economy, then the program prompts the passenger when the next flight is 
           {
               System.out.println("Sorry, the flight is fully booked. Next flight leaves in 3 hours.");
           }
  
           else // if the passenger chooses to be down graded to Economy, then the program assigns the passenger a seat in Economy
           {
               System.out.println("First class is fully booked. Would you like a seat in Economy? Type 1 for yes or 2 for No: ");
               int choice = input.nextInt();
               if (choice == 1)
               {
                   economySeat();
               }
  
               else // If flight is full, then the program tells the passenger when the next flight is
               {
                   System.out.println("Next flight is in 3 hours.");
               }
  
           }
  
           }
  
       }
  
       }
  
       public static void economySeat(){
  
           boolean [] seating = new boolean [11]; // Creates a new array
           Scanner input = new Scanner(System.in);
  
           for (int count = 6; count &lt;= 10; count++) // Starts the loop for Economy object
  
               if (seating[count] == false)
               {
                   seating[count] = true; // Assigns passenger a seat in Economy
                   System.out.printf("Economy. Seat number: %d\n", count);
                   break;
               }
  
               else if (seating[10]  == true)
               {
                   if (seating[5] == true) // If the paasenger does not decide to up grade to First Class, then the program prompts the passenger when the next flight is
                   {
                       System.out.println("Sorry, flight is fully booked. Next flight is in 3 hours.");
                   }
  
                   else // if the passenger chooses to be up graded to First Class, then the program assigns the passenger a seat in First Class
                   {
                       System.out.println("Economy is fully booked. Would you like a seat in First Class? Type 1 for Yes or 2 for No: ");
                       int choice = input.nextInt();
  
                       if (choice == 1)
                       {
                           firstClassSeat();
                       }
  
                       else
                       {
                           System.out.println("Next flight is in 3 hours."); // If flight is full, then the program tells the passenger when the next flight is
                       }
  
                  }
  
               }
  
  
       }
  
   }
  </code></pre>
  
  <p>Does anybody have any suggestions or at least send my in the right direction?</p>
  
  <p>Thanks.</p>