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

Write a program for C++ to help a local restaurant automate its breakfast billin

ID: 3767089 • Letter: W

Question

Write a program for C++ 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.

Explanation / Answer

#include<iostream.h>
#include<conio.h>

void main()
{
   struct rest
   {
       char item[10];
       float rate;
       int qty;
   };
   struct rest a[5];

   int i=0,j,c=0,itemtot=0,tot=0;
   char ans='y';
   float tax;

   cout<<" Plain egg $1.45";
   cout<<" Bacon and egg $2.45";
   cout<<" Muffin $0.99";
   cout<<" French Toast $1.99";
   cout<<" fruit Basket $2.49";
   cout<<" Cereal $0.69";
   cout<<" Coffee $0.50";
   cout<<" Tea $0.75";

   while(ans=='y')
   {
       cout<<" Enter Item";
       cin>>a[i].item;
       cout<<" Enter Item Rate";
       cin>>a[i].rate;
       cout<<" Enter Quantity";
       cin>>a[i].qty;
       cout<<" Do want any more[y/n]?";
       cin>>ans;
       i++;
   }

   for(j=0;j<=i;j++)
   {
       tot=a[i].rate*a[i].qty;
       cout<<a[i].item<<" "<<tot<<endl;
       itemtot=itemtot+tot;
   }
   tax=itemtot*2/100;
   cout<<" Tax"<<" "<<tax;
   cout<<" Amount Due"<<" "<<(itemtot+tax);
   getch();
}

      

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote