I have screenshot what I need to do and what I did. can I have help with the corrections? I have just done the first part.
1. Problem Statement: The goal of this programming assignment is to give students experience creating an interactive program that uses nested conditional statements to implement a series of menus. In particular, your task is to write a program that simulates a web service where users can order food items at three popular restaurants. To meet these goals, your program should do the following: Print a message asking the user which restaurant they wish to order from (e.g. McDonald’s, Wendy’s or Chick-fil-A). You should also include instructions on what to enter to select a restaurant. For example, one option is to use integers 1,2,3. Another option is to use single characters M,W,C. It is up to you to choose what the user should type. Read the user’s input from above, and use this information to decide what list of food menu items to print. To keep things short and simple, your three menus should only include five items each. For each menu item, you should print the name of the item and the price of the item (e.g. Big Mac Meal $5.99). You should also print instructions on what the user must type to select an item. For example integers 1,2,3,4,5 or single characters A,B,C,D,E. Again, this is up to you . Read the user’s input of the menu item they wish to buy, and ask them how many orders of that item they want to buy. Read the integer item quantity from the user, and calculate and print the total cost for this purchase using the formula “total cost- item price*tem quantity sales tax”. To keep things simple, lets pretend the sales tax rate is 5% of the purchase price Your program should do some basic error checking. If the user does not choose a restaurant correctly, your program should print the message “Sorry, that restaurant is not available” and exit. If the user types in an invalid food item, your program should print the message “Sorry, that is an food item is not available” and exit. Finally, if the user enters a negative quantity, the program should print the message “Sorry, item quantity must be positive” and exit. You do NOT need to loop asking the user to enter their choice again. . is project is about conditional statements (and not loops) you are NOT red to handle multiple orders at one time. The user will just have to run your program a second time to order something else. 2. Design: This nrgiect is all ahout nrinting messages reading user innuts and nerforming
Expert Answer
Hi,
Your code is mostly correct, except for the looping part, it is said in the question that, you need to handle only one order,
therefore
remove while(choice==1 || choice==2 || choice==3) and replace it with
if((choice==1 || choice==2 || choice==3)
{
if(choice==1)
{
//print the food menu here- i am not doing becuase, you didnt give the menu for other restaurants in the question
cout<<“enter your item choice”;
cin>>c;
if(c<1 || c>5)
{
cout<<“invalid item choosen”;
return 0;
}
else
{
cout<<“enter quantity” ;
cin>>quantity;
if(quantity<0)
{
cout<<“negative quantity entered”;
return 0;
}
else
{
total_cost= price*quantity+sales_tax;
}
}
}
}
else
{
cout<<“sorry only these 3 restaurants availble”;
return 0;
}
The above is a sample for one restaurant, you can follow the same for other two.