Can someone help me with this C program Write a program to h
Can someone help me with this C++ program:
Write a program to help a local restaurant automate its breakfast billing system. 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. They should be able to specify the number of each individual item they want.
Calculate and print the bill.
Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item):
Plain Egg $1.45
Bacon and Egg $2.45
Muffin $0.99
French Toast $1.99
Fruit Basket $2.49
Cereal $0.69
Coffee $0.50
Tea $0.75
Here is a sample output:
Welcome to Johnny\'s Restaurant
1 Bacon and Egg $2.45
2 Muffin $1.98
1 Coffee $0.50
Tax $0.25
Amount Due $5.18
A data file is provided which has the menu item on a line followed by the price, followed by the next menu item, followed by its price, etc.
Turn in your source code which should be commented as follows:
Analysis at the top of the file
Function analysis, preconditions, and postconditions after each function prototype
Major tasks identified as comments in main function
Comments in functions as needed
Text file data:
Solution
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a;
// INITIALIZATION of menu and price array to store menu and price of it
string menu [8];
string price [8];
std::string line;
//INITIALIZATION of vector to store the data from file
std::vector<std::string> DataArray;
//instead of myfile write the name of the file to take input from
std::ifstream myfile(\"myfile\");
if(!myfile) //Always test the file open.
{
std::cout<<\"Error opening output file\"<< std::endl;
//system(\"pause\");
return -1;
}
while (std::getline(myfile, line))
{
// push each line to vector
DataArray.push_back(line);
}
// storing the menu item from the DataArray in menu array
int ab =0;
for(int i=0;i<(DataArray.size())/2;i++){
menu[i]=DataArray[ab];
ab=ab+2;
}
ab=1;
// storing the price of item from the DataArray in price array
for(int j=0;j<(DataArray.size())/2;j++){
price[j]=DataArray[ab];
ab=ab+2;
}
for (int i =0; i< (sizeof(price)/sizeof(*price)); i++ ){
cout << \"press \" << i+1 << \" to order \"<<menu[i]<<\" : \"<< (double)atof(price[i].c_str()) << endl;
}
int order;
cout << \" Welcome to Johnny\'s Restaurant \" << endl;
while (cin){
int quantity;
float sum;
cout << \"what you want to order next , press 9 to check out \" << endl;
// taking order
cin >> order;
if (order == 9){
cout << \"TAX $0.25 \"<<endl;
cout << \"Amount Due \" << sum+0.25 << endl;
break;
}
cout << \"How much quantity : \";
// quantity of the order
cin >> quantity;
cout << quantity << \" \"<< menu[order] << \" \" << quantity*(double)atof(price[order].c_str())<< endl;
sum = sum + quantity*(double)atof(price[order].c_str());
}
return 0;
}

