Design a program to be used for a small local diner that allows customers to
see the diner's menu and then make their meal selections using the program.
The program will also calculate and print an itemized bill.
Define a record (struct), menuItemType, with two components: menuItem of type
string and menuPrice of type double. Use an array, menuList, of the struct
menuItemType so that you just need to print the array to print the entire menu.
The program should do the following:
Show the customer the different breakfast items offered by the restaurant.
Allow the customer to select more than one item from the menu.
Assign the customer a number from 0 to 99.
Calculate and print the bill with the customer number.
Save the customer's selections and amount due in an array of records using their
customer number as the index. Assuming that the diner will never have more than
100 customers at one time, the program can cycle back to index 0 when it reaches
the end of the array at index 99.
Clear the screen for the next customer.
Although your team may decide to add items, assume that at the minimum the diner
offers the following breakfast items (the price of each item is shown to the right of the item):
Two Scrambled Eggs .................................. $2.25
Bacon, Egg, and Cheese on a Hard Roll ....... $3.25
Corn Muffin .............................................. $1.49
French Toast Plate ..................................... $3.99
Fruit Plate ................................................. $3.49
Cereal and Milk ......................................... $1.49
Coffee ...................................................... $1.50
Tea ........................................................... $1.00
Your program must contain at least the following functions:
Function getData: This function allows the restaurant owner to load the data
into the array menuList. Should provide a facility for the owner to change menu
items and prices.
Function showMenu: This function shows the different items offered by the
restaurant and tells the user how to select the items.
Function printCheck: This function calculates and prints the check.
(Note that the billing amount should include a 8.125% tax.)
A sample output could be:
Welcome to DCC Diner!
Your Customer Order Number is 34
1 Bacon, Egg, and Cheese on a Hard Roll ........... $3.25
2 Corn Muffin .................................................. $2.98
1 Coffee .......................................................... $1.50
Total ............................................................... $7.73
Tax ................................................................. $0.63
Amount Due ................................................... $8.36
Format your output with two decimal places. The name of each item
in the output must be left justified.
-----------------------------------------------------------------------------------
int main()
{
double menuItem[row][col];
double itemPrice[row][col];
getData(menuItem);
showMenu();
return 0;
}
//*******************************************
void getData(double menuList[row][col])
{
ifstream infile;
int x;
int y;
string item;
double price;
infile.open("Menu.txt");
for (x=0; x<12; x++)
{
for (y=0;y<2;y++)
{
getline(infile, menu[x].menuItem);
item = menu[x].menuItem;
infile >> menu[x].itemPrice;
price = menu[x].itemPrice;
cout << left << item << setw(15) << setfill('.') << setprecision(2) << right;
}
}
infile.close();
}
//************************************************
void showMenu()
{
int x;
int y;
for (x=0; x<24; x++)
{
for (y=0; y<1; y++)
{
cout << left << theMenu[x].menuItem << setw(20) << right << theMenu[y].itemPrice << endl;
}
}
}
//************************************************************