The following is my homework assigment. I have it more or less complete. I would like feedback from the community on what I can improve in the program. Basically, before I hand it in to my professor, I want a fresh pair eyes to take a look at it. There's also three lines that I want to edit in the program but I'm not sure how to do it. I wrote comments in capital letters next to those lines. I'm almost sure that my professor will overlook those lines. I want your feedback for my benifit. As I mentioned before, I'm new to C#. Please and thank you.

(Airline Reservations System) A small airline has just purchased a computer for its new automated reservations system. You have been asked to program the new system. You are to write an application to assign seats on each flight of the airline’s only plane (capacity: 10 seats).
Your application should display the following menu of alternatives— Please type 1 for "First Class" and Please type 2 for "Economy". If the person types 1, your application should assign a seat in the first class section (seats 1-5). If the person types 2, your application should assign a seat in the economy section (seats 6-10)
Use a single-dimensional array of simple type bool to represent the seating chart of the plane. Initialize all the elements of the array to false to indicate that all seats are empty. As each seat is assigned, set the corresponding elements of the array to true to indicate that the seat is no longer available.
Your application should never assign a seat that has already been assigned. When the first class section is full, your application should ask the person if it is acceptable to be placed in the first class (and vice versa). If yes, then make the appropriate seat assignment. If no, then print the message "Next flight leaves in 3 hours."

using System;

class AirlineResevationSystem
{
    static void Main()
    {
        int seatsFirst, seatsEconomy, reserve, i = 0, j = 6;
        bool[] seats = { false, false, false, false, false,
                         false, false, false, false, false }; // seating chart 
        Console.WriteLine("Welcome to Airline Reservation System."); // greet the user 

        while (true)
        {
            Console.WriteLine("There are " + checkFirstClass(out seatsFirst, seats) + " first class seats and " + checkEconomy(out seatsEconomy, seats) + " economy seats."); // check available seats
            Console.WriteLine("Please enter 1 to reserve a first class seat or enter 2 to reserve an economy class seat or 0 to exit"); // promt user for input 
            reserve = Convert.ToInt32(Console.ReadLine()); // input from user
            if (reserve == 1)
            {
                if (i > 5 || i == 5)
                {
                    Console.WriteLine("There are no first class seats available. Would you like an economy class seat? Type 2 for yes and 0 to exit.");
                    reserve = Convert.ToInt32(Console.ReadLine()); // RIGHT HERE I WOULD LIKE THE PROGRAM TO GO BACK TO THE INITIAL IF STATEMENT AND CHECK THE CONDITIONS. ANY ADVICE? 
                }
                else reserveFirstSeat(ref seats, ref i); // reserve first class seat
            }
            else if (reserve == 2)
            {
                if (j < 5 || j > 10)
                {
                    Console.WriteLine("There are no economy seats available. Would you like a first class seat? Type 1 for yes and 0 to exit.");
                    reserve = Convert.ToInt32(Console.ReadLine()); // RIGHT HERE I WOULD LIKE THE PROGRAM TO GO BACK TO THE INITIAL IF STATEMENT AND CHECK THE CONDITIONS. ANY ADVICE? 
                }
                else reserveEconomySeat(ref seats, ref j); // reserve economy class seat
            }
            else if (reserve == 0)
            {
                Console.WriteLine("Next flight leaves in three hours."); // ALSO, I WANT TO ADD HOW MANY FIRST CLASS TICKETS WERE RESERVED IF ANY AND SAME THING FOR ECONO CLASS BUT I'M NOT SURE HOW TO KEEP TRACK OF IT. ANY ADVICE?
                break;
            }
            else 
            {
                Console.WriteLine("Invalid entry. Please try again");
            }


        }
    }



    public static int checkFirstClass (out int seatsFirst, bool [] seats) // method to check available First Class seats
    {
        seatsFirst = 0; 
        for (int i = 0; i<5; i++) 
        {
            if (seats[i] == false) 
                seatsFirst++;
        }

        return seatsFirst;
    }

   public static int checkEconomy (out int seatsEconomy, bool [] seats) // method to check available Economy seats
    {
        seatsEconomy = 0; 
        for (int i = 5; i<10; i++) 
        {
            if (seats[i] == false) 
                seatsEconomy++;
        }

        return seatsEconomy;
    }

        public static void reserveFirstSeat (ref bool [] seats, ref int i) // reserve selected first class seat 
    {


         if  (i<5)
         {
             if (seats[i] == false)
             {
                 seats[i] = true;
                 Console.WriteLine("You have successfully reserved a first class seat");
             }
         }
          ++i;

     }

   public static void reserveEconomySeat (ref bool [] seats, ref int j) // reserve selected economy class seat
    {
        if (j > 5 || j == 5 || j<10)
        {
            if (seats[j] == false)
            {
                seats[j] = true;
                Console.WriteLine("You have successfully reserved an economy class seat");

            }
        }
        ++j;

    }
}

In my humble opinion, and at a quick glance, your Main function has way too much responsibility. Have you all learned about object oriented programming (OOP)?

I did. In C++, the last thing we covered was creating classes, constructions, private and public data types and creating objects. Now, I'm taking C#. We're just starting to over it in class.

Very much agree with Sharron 1(welcome! btw)
One thing I see immediately:
Make the number of first class and economy seats as constants. Adapt the rest of your program accordingly.
Why?
If the compagny buys a bigger plane later, you only have to change some numbers, you don't have to wade through all your code to change them where needed.

Thanks for the advice. Honestly, I havent had time to work on it. We moved on to learn about classes, objects, and inheritance. I understand the general idea but I'm having a little problem following the syntax. We got assigned another homework assigment. So that one is a bigger priority. I'm still working on it. It will use classes and objects. But I dont have anything concrete to post yet. I wont forget about this problem though. I'm taking next semester off from school and I really want to use that time to practive programming on my own time at my own pace. Again, thanks everybody. :)

Here at DaniWeb, we are awaiting your questions, if you have any. :)

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.