Project 8
Due Date: beginning of lecture, Thursday, April 13 20, 2006
The goal of this project is to gain experience
with C arrays.
Project:
A small airline has just purchased a computer for its new automated
reservations system. The president has asked you to program the new
system. You are to develop a program to assign seats on each flight of
the airline's only plane. This plane has 19 seats: 4 first-class seats
(seats 1-4) and 15 economy seats (seats 5-19).
Your program should display the following menu of alternatives:
Please type 1 for "first class"
Please type 2 for "economy"
If the user types 1, then the program will assign the next available
seat in the first class section. If the user types 2, then the program
will assign the next available seat in the economy section. The program
will then display a "boarding pass" message indicating the person's
seat number and whether it is in the first class or economy section of
the plane. Example:
Your seat assignment is in
economy, seat 11.
Use a single-subscripted array to represent the seating chart of
the plane. Initialize all the elements of the array to 0 to indicate
that all seats are empty. As each seat is assigned, set the
corresponding element of the array to 1 to indicate that the seat is no
longer available.
The program will, of course, never assign a seat that has already been
assigned. If the first class section is full, the program will ask the
person if it is acceptable to be placed in the economy section (and
vice versa). If yes, then make the appropriate seat assignment. If no,
or if the plane is completely full, then print the message
Next flight leaves in 3 hours.
What to submit:
You must follow the project preparation and submission documents on the
website.
Your grade will be calculated on a 20-point basis, as follows:
- 6 points -- analysis and design (including algorithm in
structured
English)
- 4 points -- test plan
- 6 points -- correct execution of program according to test plan
- 4 points -- layout and style of program source code
Extra credit:
We'll continue the 2-point bonus for getting an early start. If you
e-mail
your "framework" listing file to Prof. Feldman, and the time stamp on
the
e-mail is no later than 5 PM, Monday, April 10 17, 2006, you will be
awarded
2 extra project points. The "framework" must be a listing (.txt)
file, with no compilation errors or warnings, that contains the
declared
variables, and a set of comments inserted for the main algorithm steps.
MBF 4/4/06