Topical Information

This project will help you show your mastery of 2D storage/processing (and branching, looping, etc.).

Program Information

Write a program to solve problem 13 from page 564-5 in chapter 10.

Note the way seats are to be entered: 1A, 4C, etc. So you get a row number and a seat letter! You'll have to map that letter to a proper position via a numeric form. At least you can simply subtract 1 from the row like we always expect. But for the seat letter mapping, consider type-casting and ASCII code manipulation. See the lab for a char digit to integer example as well as the ASCII table in the appendix -- not to look for codes, but to notice that all the letters in each case are contiguous. And don't forget that most people will type 1a instead of 1A -- but not all!

You can tell the user is done when they enter an invalid seat selection like 'quit' instead of '6b'. (Hint: What would happen here in terms of input processing..?)

However, make the first 2 rows first class, the next 2 rows business class, and the last 3 rows in the plane coach class. Ask the user their class preference and do your best to place them in the proper section. If they cannot fit in their section, tell them they may choose another section or simply not take the flight.

This assignment is (Level 6).

Options

Add (Level 1) to allow them to choose an aisle, window, or inside seat. For an inside seat, you'd have to change the plane map to add at least one seat to a side of the plane:

       1      X B   C D E
       2      A X   C D E
       3      A B   C D E
       4      A B   X D E
       5      A B   C D X
       6      A B   C D E
       7      A B   C X E

Add (Level 1) to allow them to specify they'd like an exit seat. (The exit rows are usually more roomy since people will have to climb out there.) You'll have to designate which rows have exits and remember this somehow.

Add (Level 2) to allow the user (probably airline personel) to specify how many rows are in the plane overall, how many rows make up first class and coach (business will be what's left), and how many seats are in each row. This should be done when the program first runs -- not between each passenger booking.