Question: Airline Scheduling Project In C Language (not C++) Write a reservation system for an airplane flight. Assume the airline has 5 rows with 3 seats
Airline Scheduling Project
In C Language (not C++)
Write a reservation system for an airplane flight. Assume the airline has 5 rows with 3 seats in each row (small plane!). Use a 2 dimensional array of type string to maintain a seating chart. In addition, create an array to be used as a waiting list in case the plane is full. The waiting list should be "first come, first served"; that is, people who are added early to the list get priority over those added later. Also, you must maintain a second 2 dimensional array (a parallel array) that reflects the cost of the seats. Pricing for the seat is described below. Keep a running tally of the money earned on each flight. Allow the user the following options:
1. Add a passenger to flight or waiting list
a. Request the passenger list
b. Display a chart of the seats in the airplane in tabular form, clearly titled, with the row and seat numbers clearly listed
c. If seats are available, let the passengers choose a seat. Inform the passenger of the seating cost. Add the passenger to the seating chart.
d. If no seats are available, place the passenger on the waiting list. Assume that the waiting list will grow to a maximum capacity of 10 passengers.
2. Remove a passenger from a flight
a. Search seating chart in the plane for a given name and delete this name from the seating chart. Ask for confirmation prior to deletion. There will not be any duplicate names.
b. If waiting list is empty, update the array so seat is available.
c. If waiting list is not empty, remove the first person from list, give him/her the newly vacated seat.
3. Allow the user an option to display the passenger list or the seating price list as desired.
4. Initialize the arrays that are used in the following manner:
(a) Initialize string arrays to xxxxx
(b) Initalize numeric arrays to 0.00
5. Seat pricing.
a. Seats in the first 2 rows are first class and cost $200.00
b. Seats in the last 3 rows are coach class and cost $100.00
c. Seats in the middle receive a 10% discomfort discount.
In C Language (not C++), Create and implement functions as you think best. (Use them to the maximum extent.) Code your program so that the main( ) function is of small size and relies upon the functions created to achieve to functionality described above. [Remember, arrays are always passed by reference. If you need to change an array, do it within a function and the array, as seen from the main, will also be changed.]
double vectors_dot_prod(const double *x, const double *y, int n) { double res = 0.0; int i; for (i = 0; i < n; i++) { res += x[i] * y[i]; } return res; }
void matrix_vector_mult(const double **mat, const double *vec, double *result, int rows, int cols) { // in matrix form: result = mat * vec; int i; for (i = 0; i < rows; i++) { result[i] = vectors_dot_prod(mat[i], vec, cols); } }
In C Language (not C++) That is the main function I don't know how to do the rest. Thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
