Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Format the input file following manner: o Each line of the input file should con

ID: 3809255 • Letter: F

Question

Format the input file following manner: o Each line of the input file should contain three tokens: an integer, a string, and a decimal. They represent the item number, name, and price, respectively. o The file can contain any number of lines (minimum 7). o Item numbers must be unique, but do not need to be ordered. Write functions to perform each of the following tasks: o Prompt the user to enter the path to a file until: the file is successfully opened the user types "EXIT" Preserve this path for future use and close the file. Returns true if the file was opened successfully, false otherwise o Prompt the user to enter the waiter's first name. Return the name o Send a greeting to the customer. The greeting should include the waiter's name. o Print the menu Accept the path to the file as an argument. Use the formatting specified in the sample output. o Search the input file for an item with a given number. If the number is found, this information should be available after the function ends the name of the item the price of the them Return true if the item is found false otherwise. o Prompt the user to order an item from the menu by number. Use the previous function to find the ordered item; if found: Update the total number of items ordered. Add the name of the item to the list of items ordered. Update the total amount charged. Prompt the user to ask the customer if the order is complete. Accept an affirmative or negative response using a character or a string. If a negative response is received, repeat the ordering process above. Otherwise, end the function. The following information should be available after the function ends The total number of items ordered.

Explanation / Answer

#include<iostream>
#include<fstream>

using namespace std;

int main() {
  
string name, path,yorn;
cout << "Enter the absolute path to the file.";
cin >> path;
cout << "Enter in your name tag please.";
cin >> name;
cout << "Thanks "<< name << endl;
cout << "Now get to work. " << endl;
  
ifstream myReadFile;
myReadFile.open("menu.txt");
char output[100];
int i=0, j=1, n, order[10];
cout << "+---------------Menu---------------+ ";
cout << "| # | Item | Price| ";
cout << "+----------------------------------+ ";
order[1]=1;
if (myReadFile.is_open()) {
while (!myReadFile.eof()) {
myReadFile >> output;
  
cout<<" "<<output<<" ";
i++;
if(i%3==0){
order[j]=i;
j++;
cout << " ";
}
}
}
cout << "------------------------------------ ";
myReadFile.close();
  
cout << "What can I get for you this evening?(Order by Number): ";
cin >> n;
int found=0;
for(int k=0;k<10;k++){
if(n==k){
found=1;
}
}
  
if(found==1){
cout << "Okay I think we still have that. ";
}else{
cout << "Uh, I dont think we have those ";
}
  
cout << "Would you like anything else(Y/N):";
cin >> yorn;
cout << yorn;
return 0;
}