Assigned: Tuesday January 21, 2003 Deadline: Tuesday January 28, 2003 Questions 1 and 2 are due BEFORE class Program is due at MIDNIGHT Questions: ---------------------------------------------------------------------------- Question 1: Find the error(s) in each of the following statements: a) Assume that: char str[5]; cin >> str; // User types "Hello" b) Assume that: int a[3]; cout << a[1] << " " << a[2] << " " << a[3] << endl; c) Assume that: double d[2][10]; d[1,9] = 2.345; ---------------------------------------------------------------------------- Question 2: What does the program do? #include using namespace std; void someFunction( int [], int, int); int main() { const int arraySize = 10; int a[ arraySize ] = { 1,2,3,4,5,6,7,8,9,10 }; cout << "The values in the array are: " << endl; someFunction ( a, 0, arraySize); cout << endl; return 0; } void someFunction( int b[], int current, int size ) { if( current < size ) { someFunction( b, current + 1, size ); cout << b[current] << " "; } } ---------------------------------------------------------------------------- WRITE THE BELOW PROGRAM which is An extension to Problem 4.20 from Deitel and Deitel: The purpose of this program is to introduce you to the use of ARRAYS. Name the program Airline, and let it reside in a directory called 1730_program2. Be sure to modularize your program properly (use functions when appropriate) and include meaningful comments. 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 a program to assign seats on each flight of the airline's only plane (capacity: 15 seats). Your program should display the following menu of alternatives PLEASE TYPE 'F' FOR FIRST CLASS TICKET 'E' FOR ECONOMY SEATING. 'V' FOR VIEW SEATING CHART 'Q' FOR QUIT PROGRAM If the person types "F", your program should assign a seat in the first class section (seats 1-5). If a person types "E", your program should assign a seat in the coach section (seats 6-15). If a person types 'V', it prints out the seating chart indicating which seats are reserved and which are empty. Your program should print a boarding pass indicating the person's seat number and whether it is first class or coach seating on the plane. The program should continue running until the user enters 'Q' to quit the program. Your program should never assign a seat that has already been assigned. When first class or the economy section is full, your program should ask the user if they wish to be placed in the other section. If yes, then make the appropriate seating assignment. If no, print the message, "Next flight leaves in 3 hours." HINTS: Use an array to represent the seating chart. Initialize all the elements of the array to 0 to indicate all seats are empty. As each seat is assigned, set the corresponding elements to 1 to indicate the seat is no longer available. REQUIREMENTS: * You must use at least two FUNCTIONS in your program. At least one must return a value. At least one must pass an array as its argument. * You must submit the at least the following files (i.e., all the files necessary to compile your program): README.txt Airline.cpp Makefile To submit the files, you will need to use the submit program. Your files need to be under a common subdirectory called "1730_program2". Execute the below command line while in your homedirectory: submit 1730_program2 cs1730 NOTE: you need to be LOGGED ONTO ajax when you execute the submit command.