****I'm stuck as to what my next step should be?? I also want to know if I'm on the right track. I've tried searching for some type of sample program as I am sure there are plenty, but when I start to write it doesn't seem to make sense. Any sort of help is appreciated. Thank you.
*************************
Write a program to help a cafe automate its breakfast billing system. The program should do the following:
• Show the customer the different breakfast items offered by the restaurant. The items are in a file so it can easily be changed. The name of the file is MenuData.txt.
• Allow the customer to select more than one item from the menu.
• Calculate and print the bill.
Use a struct called menuItemType that has the follwing members: a string called menuItem and a double called menuPrice.
Use an array called menuList to store the menu which is read in from the file. Use a constant global variable to set the number of items in the menu so it can easily be changed if the number of items changes.
The program must contain the following functions:
• getData: Load the data from the file into the array menuList.
• showMenu: Display the menu to the customer. The customer must be told how to select items.
• printCheck: Calculate and print the check. A 5% tax is added to the total.
Output should be formatted to two decimal places. The name of each item must be left-justified. You may assume a user selects only one item of a particular type.
Sample Output
Thank you for eating at Our Restaurant
Bacon and Egg $2.45
Muffin $0.99
Coffee $0.50
Tax $0.20
Amount Due $4.14
************************************************
This is what I have so far. I didn't think it was too long to post it all.
#include <iostream>
using namespace std;
struct menuItemType
{
char menuItem[21];
double menuPrice;
};
const int numitems = 8;
int main ()
{
int i = 0;
menuItemType.menuList [listLength];
while ( i < listLength)
{
cout << i + 1 << " " << menuList [i] menuItem
<< " " << menuList [i] menuPrice
<< endl;
i++;
}
system ("pause");
return 0;
}
void showMenu ()
{
}
void getData ()
{
fstream file;
char ch;
for (int i = 0; i < listLength; i ++)
{
file.get(menuList [i].menuItem, 21);
file >> menuList [i].menuPrice;
file.get(ch);
}
}
void printCheck ()
{
}