Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

struct menuItemType
{
string menuItem;
double menuPrice;
};

void getData(menuItemType menuList[]);
void showMenu(menuItemType menuList[] , int n);
void printCheck(menuItemType menuList[], int menu_order[], int n);

int main()
{
const int item = 8;
menuItemType menuList[item];
int menu_order[item] ={0};
int choice =0;
int count =0;
bool order = true;
getData(menuList);
showMenu(menuList,item);
while(order)
{
cout<<"Enter the choice for the order or press 0 to exit"<<endl;
cin>>choice;
if(choice>0 && choice<=item)
{
menu_order[choice-1]+=1;
}
else
{
order=false;
}
}
printCheck(menuList,menu_order,item);
return 0;
}

void getData(menuItemType menuList[])
{
menuItemType plainEgg;
menuItemType baconEgg;
menuItemType muffin;
menuItemType frenchToast;
menuItemType fruitBasket;
menuItemType cereal;
menuItemType coffee;
menuItemType tea;
plainEgg.menuItem = "Plain Egg";
plainEgg.menuPrice = 1.45;
baconEgg.menuItem = "Bacon and Egg";
baconEgg.menuPrice = 2.45;
muffin.menuItem = "Muffin";
muffin.menuPrice= 0.99;
frenchToast.menuItem = "French Toast";
frenchToast.menuPrice = 1.99;
fruitBasket.menuItem = "Fruit Basket";
fruitBasket.menuPrice = 2.49;
cereal.menuItem = "Cereal";
cereal.menuPrice = 0.69;
coffee.menuItem ="Coffee";
coffee.menuPrice = 0.50;
tea.menuItem = "Tea";
tea.menuPrice = 0.75;
menuList[0] = plainEgg;
menuList[1] = baconEgg;
menuList[2] = muffin;
menuList[3] = frenchToast;
menuList[4] = fruitBasket;
menuList[5] = cereal;
menuList[6] = coffee;
menuList[7] = tea;
}

void showMenu(menuItemType menuList[], int n)
{
int count;
cout<<"Restaurant Breakfast Menu"<<endl;
cout<<endl;
for(count=0; count<n;count++)
{
cout<<setw(2)<<left<<count+1<<setw(20)<<left
<<menuList[count].menuItem<<'$'<<menuList[count].menuPrice<<
endl;
}
}

void printCheck(menuItemType menuList[], int menu_Order[], int n)
{
double Bill = 0;
double calculated_Tax =0;
const double Tax = .05;
cout<<"Welcome to Johnny's Restaurant"<<endl;
for(int i=0;i<n;i++)
{
if(menu_Order[i]>0)
{
cout<<fixed<<setprecision(2)<<setw(20)<<left<<
menuList[i].menuItem<<'$'<<(menuList[i].menuPrice*menu_Order[i])
<<endl;
Bill+=(menuList[i].menuPrice*menu_Order[i]);
}
}
calculated_Tax = Bill* Tax;
Bill+= calculated_Tax;
cout<<setw(20)<<left<<"Tax"<<'$'<<fixed<<setprecision(2)
<<calculated_Tax<<endl
<<setw(20)<<left<<"Amount Due"<<"$"<<Bill<<endl;
}

 

Redo the C++ code above so that the output is what the picture shows. 

 

Welcome to Johnny's Restaurant
1 Bacon and Egg
$2.45
$1.98
$0.50
$0.25
$5.18
2 Muffin
1 Coffee
Таx
Amount Due
expand button
Transcribed Image Text:Welcome to Johnny's Restaurant 1 Bacon and Egg $2.45 $1.98 $0.50 $0.25 $5.18 2 Muffin 1 Coffee Таx Amount Due
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education