I have a project I am working on but I honestly can't get a hold of a good jump off point. I'll post the pseudo code. I really need the help please. It is for a GUI C++ program. Please help me if anyone can. All I need is a jump off point.

Oh wow I can't believe I forgot to post the pseduocode and instructions.

Bluebird Airlines needs a program to assign boarding passes on its only plane which has a seating capacity of 20. They want to use an alphnumeric seat number, and they want to be able to assign a passenger to a specific seat within either first or business class. The seats in the plane are numbered as follows:

FIRST CLASS BUSINESS CLASS
1A, 1B, 2A, 2B
4A, 4B, 4C, 4D 
5A, 5B, 5C, 5D
6A, 6B, 6C, 6D
7A, 7B, 7C, 7D

The first 4 seats are first class and the remaining 16 are business class. Store the seating information in arrays. One array for the seat number and another array for the passenger's name. You will need to hard code the seat number array and set every element of the passenger array to blanks. If a seat is empty, the corresponding array element is blank. If a seat is reserved, the corresponding array element has someone's name in it. Display the Plane Manifest in a ListBox at the bottom of the window form.

The program should prompt the user to enter the passenger's name, select the class of the ticket (First or Business), and select the seat number. The windows form will have a text box to input the passenger's name; two combo boxes: flight class and seat number; two buttons: Add Passenger and Close Flight; and a rich text box to display the plane manifest. The ComboBoxes need to have a DropDownStyle of DropDownList. You will populate the seat number combo box with the available seats of the class selected. You will need an event handler for the class combo box that indicates when the user has changed the class. Depending on the class selected, you will populate the seat number combo box with the available seats for that class.

The user will enter the passenger's name, select the flight class, and the seat number and press the Add Passenger button. The program will validate the data in the fields. The passenger's name must not be left blank; otherwise, a MessageBox will be displayed indicating the error and the user will be returned to the passenger's name text box. If the seat is left blank, display an error message and return to the seat number. If everything is ok, assign the passenger to the seat, update the Plane Manifest, clear the name field, set the class back to First, and the seats back to available first class seats, and return the user to the passenger name field.

Once the plane is full, disable the Add Passenger button. The user will then need to close the flight.

Even though the plane is not full, the user may close the flight by pressing the Close Flight button. Disable the Add Passenger button and change the text in the Close Flight button to Start a New Flight. In the rich text box in addition to displaying the Plane Manifest, display the number of first class passengers and business class passengers, and a passenger list. The passenger list is in alphabetical order by passenger name. Only display assigned seats in the passenger list. You will need to sort the data into alphabetical order by passenger name to display the passenger list. Also write these reports to a text file.

When the user clicks the Start a New Flight button, change the button back to Close Flight, enable the Add Passenger button, and clear the passenger name array and the fields on the screen. An empty Plane Manifest should be displayed in the rich text box.

If the user double clicks an entry in the list box, delete that passenger from the seat.

For the 2 Combo Boxes in this application make the DropDownStyle a DropDownList.

Do not do all of the work in the button event handlers. Write other methods that are called from the event handlers to do the work.

Hints:

To load the data in the flight class combo box, set up an array and set the combo box DataSource to the array reference.

        // defined as an attribute value of the form class
private string[] flightClassAr = {"First", "Business"};
// Done in the form constructor after InitializeComponent()
FlightClassComboBox.DataSource = flightClassAr;

Using the pseudo code below, write the code that will meet the requirements:

At the top of the form class declare the following:

bool activeFlight = true;
private string[] passNameAr = {"", "", "", "", "", "", "", "",
    "", "", "", "", "", "", "", "", "", "", "", "" };
private string[] seatAr = {"1A", "1B", "2A", "2B", "4A", "4B", "4C", "4D",
    "5A", "5B", "5C", "5D", "6A", "6B", "6C", "6D", "7A", "7B", "7C", "7D" };
private int numFirstClass = 0, numBusinessClass = 0;
private string[] flightClassAr = { "First", "Business" };

In the form constructor after InitializeComponent():

Set the flight class combo box data source to the flight class array
Clear the seat number combo box and dynamically populate it with the first 
       class seats
Set the seat number combo box's selected index to 0
Call the DisplayManifest() method

In the Add Passenger button click event handler:

Ensure that the name was not left blank.
Locate the index position of the seat in the seat array.
Call the AssignSeat() method passing it the passenger name, flight class 
    and seat index
Call the DisplayManifest() method.
Call the PopulateSeatCombo() method.

In the Close Flight button click event handler:

If the flight is active
    Call the DisplayManifest() method
    Call the DisplayPassengerList() method
    Set the text of the Close Flight button to "Start a New Flight";
    Set activeFlight to false
    Make the Close Flight button the control of focus
    Disable the Add Passenger button
Else
    Set the text of the Close Flight button to "Close Flight";
    Enable the Add Passenger button
    Blank out the passenger name array
    Sort the seat array in ascending order.
    Clear the seat number combo box and dynamically populate it with 
             the first class seats
    Set the seat number combo box's selected index to 0
    Reinitialize first class and business class counters
    Call the DisplayManifest() method
    Set activeFlight to true
    Make the Passenger Name text box the control of focus

Flight Class combo box selected index changed event handler:

If the user selected first class
    Dynamically populate the seat number combo box with the available 
             first class seats
Else
    Dynamically populate the seat number combo box with the available 
             business class seats
Set the Seat Number combo box's selected index to 0

Plane Manifest list box double click event handler:

If the user clicked on a seat
    If a passenger is assigned to the seat
        Prompt the user if she wants to remove the passenger from the seat
        If the user says yes
            Delete the passenger's name from the array.
            Subtract 1 from the appropriate seat counter
            Call the PopulateSeatCombo() method
            Call the DisplayManifest() method

DisplayPassengerList() method

Sort the arrays in passenger name order
Display the number of first and business class passengers in the list box
Display the passenger list in the list box

DisplayManifest() method:

Clear the list box
Write the plane manifest to the list box

AssignSeat() method:

Assign the passenger's name to the passenger name array.
Add 1 to the first class or business class seat counter depending 
       on the flight class

PopulateSeatCombo() method:

Blank out the Passenger Name text box
Repopulate the flight class array with both flight classes
Set the Flight Class combo box data source to the flight class array
Set the Flight Class combo box's selected index to 0
Clear the Seat Number combo box
If all the seats are occupied
    Set the focus to the Close Flight button
    Disable the Add Passenger button
    Exit the method

Set the focus to the Passenger Name text box
If there are first class seats available
    Populate the Seat Number combo box with the available first class seats
    If all the business class seats are full
        Populate the flight class array with just First
        Set the Flight Class combo box data source to the flight class array
Else                
    Populate the Seat Number combo box with the available business class seats
    If all the first class seats are full
        Populate the flight class array with just Business
        Set the Flight Class combo box data source to the flight class array

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.