It may be best to use both integer arrays and/or character arrays for the follow
ID: 3579193 • Letter: I
Question
It may be best to use both integer arrays and/or character arrays for the following information:
Each table must use arrays to
a) hold the name of the party (i.e., just a last name such as Johnson is required) b) hold a marker that would be used for identifying whether the table is occupied or not, and c) store the quantity of people seated at the table.
2) The program must use functions/subprograms throughout. It must also display the following menu (see the next page):
Welcome to the ISE Restaurant Seating & Billing Program!
To choose a function, enter one of the letter choices below:
a) Show the quantity of empty tables & occupied tables b) Show the names of the parties which occupy tables (or a message if all are available) c) Assign a party to an available table (employee’s choice) d) Delete a party name if reservation is cancelled or when a party is finished e) Calculate a bill for each table when a party is done f) Quit the program
3) The program successfully executes the promises of its menu. Choices ‘c’ and ‘d’ will require additional input, and each of these menu choices must allow the option for the user to abort the entry at any time.
4) Choice ‘e’ should have a sub-menu with eight items with pricing (which can be made-up by your team). These items must include choices such as (a) a cheeseburger, (b) a hamburger (without cheese), (c) a hot-dog, (d) chicken fingers, (e) order of French fries, (f) order of onion rings, (g) a medium soda, and (h) a medium water (which should be free of charge). The medium size cup is all that is available, but free re-fills are available for all drinks from each waiter – this does not need to be modeled in your program of course!
Quantities of food items, the actual item names, and pricing for each table should be printed on a clear screen once the party has finished. Gratuity (15%) must be added automatically to the bill to tables with parties of three or more people. A 6 % tax must also be included (after the gratuity). Make this final bill look very neat and clean by using the <iomanip> library and along with the functions and keywords setw( ), fixed, showpoint, setprecision( ), etc. which you have learned earlier during the semester.
5) After executing a particular function, the program shows the main menu again (i.e., you must use the system(“cls”) statement to clear the screen before re-displaying the menu), except when choosing option ‘f’ which will quit the program. When this option ‘f’ is selected, the menu does not have to be displayed again.
Explanation / Answer
5)
do
{
cout << " **Manue**" << endl;
cout << "1) Print a Table " << endl;
cout << "2) Find the Prime Number " << endl;
cout << "3) Find the Factorial" << endl;
cout << "4) Exit Program " << endl;
cout << " Please select an option : ";
cin >> option;
if (option == 1)
{
int a, b;
cout << "Enter the number that you want to have its table" << endl;
cin >> a;
for (int c = 1; c <= 10; c++)
{
b = c*a;
cout << "The table is " << b << endl;
}
}
else if (option == 2)
{
int num, flag = 0, i = 2;
cout << "Enter the number that you want to check is a Prime or Not :" << endl;
cin >> num;
while (i < num)
{
if (num%i == 0)
{
flag = 1;
break;
}
i = i + 1;
}
if (flag == 0)
cout << "**Number is prime** " << endl;
else
cout << " **Number is not prime** " << endl;
}
else if (option == 3)
{
int i, fact = 1;
cout << "Enter the number to find its Factorial" << endl;
cin >> i;
for (int n = i; n > 1; n--)
{
fact = fact *n;
cout << fact << endl;
}
}
else
{
cout << "Invalid Option entered" << endl;
}
}
while (option != 4);
return 0;
}
4)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.