#if !defined (AIRPLANE_H_INCL) #define AIRPLANE_H_INCL #include #define ROWS 26 #define SEATS_PER_ROW 6 typedef struct { char firstName[31]; char lastName[31]; int phone; /* 7 digit number, no dashes */ double fare; /* how much they paid for the flight, e.g. 429.50 */ int weight; /* approximate weight, e.g. 140 */ } Passenger; /* Model */ /* * set all strings to "" and numbers to 0 */ extern void initializeSeatMap(Passenger seatMap[SEATS_PER_ROW][ROWS]); /* * return the row and col of the passenger with the corresponding first and last name * if no such passenger exists, row and col should both be -1 */ extern void findPassenger(char firstName[31], char lastName[31], Passenger seatMap[SEATS_PER_ROW][ROWS], int* row, int* col); /* * put passenger p in seatMap at col/row * since passenger names are strings, be sure to use strcpy */ extern void addPassenger(Passenger p, Passenger seatMap[SEATS_PER_ROW][ROWS], int row, int col); /* * reset the passenger in seatMap at col/row to the initial values * since passenger names are strings, be sure to use strcpy */ extern void removePassenger(Passenger seatMap[SEATS_PER_ROW][ROWS], int row, int col); /* * return the sum of fares for all passengers */ extern double getTotalRevenue(Passenger seatMap[SEATS_PER_ROW][ROWS]); /* * return the sum of weights for all passengers */ extern double getTotalWeight(Passenger seatMap[SEATS_PER_ROW][ROWS]); /* * return the sum of weights for all passengers in rows 1 through 13 */ extern double getFrontWeight(Passenger seatMap[SEATS_PER_ROW][ROWS]); /* * return the sum of weights for all passengers in rows 14 through 26 */ extern double getBackWeight(Passenger seatMap[SEATS_PER_ROW][ROWS]); /* View and Controller */ /* * read passenger data from flight.txt into seatMap */ extern void readPassengerData(Passenger seatMap[SEATS_PER_ROW][ROWS]); /* * write passenger data to flight.txt from seatMap */ extern void writePassengerData(Passenger seatMap[SEATS_PER_ROW][ROWS]); /* * print the which seats are available 'A' or taken 'X' */ extern void printSeatMap(Passenger seatMap[SEATS_PER_ROW][ROWS]); /* * print information on one passenger in the following form: * Name: Jones, John * Phone: 555-1212 * Fare: $429.50 * Weight: 140 */ extern void printPassenger(Passenger p); #endif