This part of the program is already done, i just need help completely the header file for the program.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
#include "airplaneSeats.h"
const int NUM_ROW = 10; // Number of rows in the airplane
int main()
{
char seatChart[NUM_ROW][NUM_COL]; // The chart of empty and filled seats
int i, j; // counters
int row; // the row the seat is in
char seat; // letter of the seat
bool ok; // stores return value from assignSeat function
int choice; // User's menu choice
bool keepLooping = true; // flag to keep showing the menu
double totalRate, firstRate, businessRate, coachRate; // filled rates
// Inialize every seat to the empty character
for( i = 0; i < NUM_ROW; i++ )
{
for( j = 0; j < NUM_COL; j++ )
{
seatChart[i][j] = EMPTY_CHAR;
}
}
// Keep the program running until the user choses to quit
while( keepLooping )
{
cout << endl << endl;
// Print the menu and get the user's choice
showMenu();
cout << endl;
choice = inputInt("..... Your choice: ", 1, 4);
cout << endl << endl;
switch( choice )
{
// Print the seating chart
case 1:
printSeatLegend();
cout << endl;
printSeats(seatChart, NUM_ROW);
cout << endl << endl;
break;
// Get the seat row and letter from user input
// If the seat is already occupied, print an error message and
// don't change the seat's status.
case 2:
row = inputInt("Please enter the row number: ", 1, NUM_ROW);
seat = inputSeat();
ok = assignSeat(seatChart, row, seat);
if( !ok )
{
cout << "Sorry, that seat is taken" << endl;
}
break;
// Print the statistics about how full the plane is
case 3:
percentFilled(seatChart, NUM_ROW, totalRate, firstRate,
businessRate, coachRate);
cout << fixed << setprecision(2);
cout << "Percent of Airplane filled: " << endl;
cout << setw(10) << "Total";
cout << setw(10) << "First";
cout << setw(10) << "Business";
cout << setw(10) << "Coach";
cout << endl;
cout << setw(9) << totalRate * 100 << '%';
cout << setw(9) << firstRate * 100 << '%';
cout << setw(9) << businessRate * 100 << '%';
cout << setw(9) << coachRate * 100 << '%';
cout << endl;
break;
// The user chose to quit so set keepLooping to false and print
// an exit message.
case 4:
keepLooping = false;
cout << "Thank you for using the seat chart program" << endl;
break;
// Print an error message if the user did not choose from 1 through 4
default:
cout << "Invalid entry" << endl;
}
}
return 0;
}
|
i have to write the functions in a different header file.
header file needs to include inputInt, inputSeat, showMenu, printSeatLegend, printSeats, assignSeat, percentFilled
the outcome of the printseatlegend is suppose to look like:
Legend:
* = empty seat; X = filled seat
f = First Class; b = Business Class; c = Coach Class
showMenu:
########################################
# MENU:
# Enter 1 to print the seat chart
# Enter 2 to select a seat
# Enter 3 to print the percentage of seats filled in each class
# Enter 4 to quit this program
please any help for the header file would be much appreciated. Any help at all to help complete this.