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

Please write a coding clearly for this question.I need to understand how to solv

ID: 3875406 • Letter: P

Question

Please write a coding clearly for this question.I need to understand how to solve the coding.

PART C (30 MARKS) QUESTION 1 MyCafe Outlet is now venturing into a fast-food business In order to realize the business, a program to manage ordering and sales need to be developed The following table shows the selected items ITEM CODE M1 M2 M3 M4 PRICE RM4. 59 RM2.99 RM1.05 RM2.49 ITEM Chicken Burger Rainbow Fillet No-Salt Fries Soft-Drink The program should allow a user to input item code and its quantity User can make another order for other items by repeat the process until user enter 'N' or 'n' for stop. If user enters the same item code, its quantity will be updated. Display an error message for an invalid item code. Then display the details of order made by the customer (including of item name, quantity and total price of all items) Write the complete C++ program based on the format of input and the output should appear as the following sample output Enter item code (M1/M2/M3/M4)M2 Enter quantity 3 Do you want to make another order? (Y/N)Y Enter item code (M1/M2/M3/M4): M7 Enter quantity: 2 Wrong item code ! Do you want to make another order? (X/N)Y Enter item code (M1/M2/M3/M4): M4 Enter quantity3 Do you want to make another order? (Y/N) Y Enter item code (M1/M2/M3/M4): M2 Enter quantity 1 Do you want to make another order? (Y/N) N Menu Item Quantity Chicken Burger Rainbow Fillet No-Salt Fries Soft-Drink Total Price: RM14 (15 marks) e Hak Cipta Universiti Teknologi MARA CONFIDENTIAL ucnt totauPrie

Explanation / Answer


#include <iostream>
using namespace std;
int main()
{
string item;
string item_code[4]={"M1","M2","M3","M4"};
float price[4]={4.59,2.99,1.05,2.49};
int quantity_list[4]={0,0,0,0};
int quantity;
char yes_no;
while(true)
{
cout<<"enter item code(M1/M2/M3/M4): ";
cin>>item;
cout<<"enter quantity: ";
cin>>quantity;
if(item_code[0]==item)
quantity_list[0]+=quantity;
else if(item_code[1]==item)
quantity_list[1]+=quantity;
else if(item_code[2]==item)
quantity_list[2]+=quantity;
else if(item_code[3]==item)
quantity_list[3]+=quantity;
else
cout<<"wrong item code"<<endl;
cout<<"Do you want to make another order Y/N: ";
cin>>yes_no;
if(yes_no=='N' || yes_no=='n')
break;
cout<<endl;
}cout<<endl;
cout<<"Menu item Quantity "<<endl;
cout<<"----------------------------"<<endl;
cout<<"Chicken Burger "<<quantity_list[0]<<endl;
cout<<"Rainbow Fillet "<<quantity_list[1]<<endl;
cout<<"No SaltFries "<<quantity_list[2]<<endl;
cout<<"Soft Drink "<<quantity_list[3]<<endl;
cout<<"Total Price :RM"<<(quantity_list[0]*price[0])+(quantity_list[1]*price[1])+(quantity_list[2]*price[2])+(quantity_list[3]*price[3]);
return 0;
}