This is my main.cpp, I need the functions.cpp to work with it, the teacher's aren't clarifying anything well, and its completly online. #include #include #include #include #include "functions.cpp" using namespace std; //struct for menuItemType struct menuItemType { string menuItem; double menuPrice; }; void getData(menuItemType menuList[]); void showMenu(menuItemType menuList[], int x); void printCheck(menuItemType menuList[], int menuOrder[], int x); int main() { // Declare functions and variables const int menuItems = 8; menuItemType menuList[menuItems]; int menuOrder[menuItems] = {0}; int orderChoice = 0; bool ordering = true; int count = 0; // Set the menu getData(menuList); // Order showMenu(menuList, menuItems); while(ordering) { cout << "Please enter the number for the item you would\n" << "like to order, or enter [0] to complete your order." << endl; cin >> orderChoice; if (orderChoice > 0 && orderChoice <= menuItems) { menuOrder[orderChoice - 1] += 1; } else ordering = false; } printCheck(menuList, menuOrder, menuItems); cin.ignore(2); return 0; } void getData(menuItemType menuList[]) { // Declare menuItemTypes menuItemType plainEgg; menuItemType baconEgg; menuItemType muffin; menuItemType frenchToast; menuItemType fruitBasket; menuItemType cereal; menuItemType coffee; menuItemType tea; // Initialize menuItemTypes variables 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 x) { // Function variables int count; cout << "Welcome to Bob Evans!" << endl; cout << "What would you to order?" << endl; for(count = 0; count < x; count++) { cout << setw(2) << left << "[" << count + 1 << "]" << menuList[count].menuItem << '$' << menuList[count].menuPrice << endl; } } void printCheck(menuItemType menuList[], int menuOrder[], int menuItems) { double checkTotal = 0; double checkTax = 0; const double TAX = .05; cout << "Thanks for eating at Bob Evans!" << "Customer check: " << endl; for(int i = 0; i < menuItems; i++) { if(menuOrder[i] > 0) { cout << setprecision(3) << setw(10) << left << menuList[i].menuItem << '$' << (menuList[i].menuPrice * menuOrder[i]) << endl; checkTotal += (menuList[i].menuPrice * menuOrder[i]); } } checkTax = checkTotal * TAX; checkTotal += checkTax; cout << setw(14) << left << "Tax" << checkTax << endl << setw(14) << left << "Total" << checkTotal << endl; } This is the functions.cpp: #include #include #include #include using namespace std; // struct for menuItemType // load data from file inline void getData(ifstream& inFile, menuItemType mList[], int listSize) { // function code } // part a inline void showMenu(menuItemType mList[], int listSize) { // function code } // part c inline void printCheck(menuItemType mList[], int listSize, int cList[], int cListLength) { // function code } inline bool isItemSelected(int cList[], int cListLength, int itemNo) { // function code } // part b inline void makeSelection(menuItemType mList[], int listSize, int cList[], int& cListLength) { // function code } Here's the breakfast.txt in case you need it: 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
This is my main.cpp, I need the functions.cpp to work with it, the teacher's aren't clarifying anything well, and its completly online. #include #include #include #include #include "functions.cpp" using namespace std; //struct for menuItemType struct menuItemType { string menuItem; double menuPrice; }; void getData(menuItemType menuList[]); void showMenu(menuItemType menuList[], int x); void printCheck(menuItemType menuList[], int menuOrder[], int x); int main() { // Declare functions and variables const int menuItems = 8; menuItemType menuList[menuItems]; int menuOrder[menuItems] = {0}; int orderChoice = 0; bool ordering = true; int count = 0; // Set the menu getData(menuList); // Order showMenu(menuList, menuItems); while(ordering) { cout << "Please enter the number for the item you would\n" << "like to order, or enter [0] to complete your order." << endl; cin >> orderChoice; if (orderChoice > 0 && orderChoice <= menuItems) { menuOrder[orderChoice - 1] += 1; } else ordering = false; } printCheck(menuList, menuOrder, menuItems); cin.ignore(2); return 0; } void getData(menuItemType menuList[]) { // Declare menuItemTypes menuItemType plainEgg; menuItemType baconEgg; menuItemType muffin; menuItemType frenchToast; menuItemType fruitBasket; menuItemType cereal; menuItemType coffee; menuItemType tea; // Initialize menuItemTypes variables 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 x) { // Function variables int count; cout << "Welcome to Bob Evans!" << endl; cout << "What would you to order?" << endl; for(count = 0; count < x; count++) { cout << setw(2) << left << "[" << count + 1 << "]" << menuList[count].menuItem << '$' << menuList[count].menuPrice << endl; } } void printCheck(menuItemType menuList[], int menuOrder[], int menuItems) { double checkTotal = 0; double checkTax = 0; const double TAX = .05; cout << "Thanks for eating at Bob Evans!" << "Customer check: " << endl; for(int i = 0; i < menuItems; i++) { if(menuOrder[i] > 0) { cout << setprecision(3) << setw(10) << left << menuList[i].menuItem << '$' << (menuList[i].menuPrice * menuOrder[i]) << endl; checkTotal += (menuList[i].menuPrice * menuOrder[i]); } } checkTax = checkTotal * TAX; checkTotal += checkTax; cout << setw(14) << left << "Tax" << checkTax << endl << setw(14) << left << "Total" << checkTotal << endl; } This is the functions.cpp: #include #include #include #include using namespace std; // struct for menuItemType // load data from file inline void getData(ifstream& inFile, menuItemType mList[], int listSize) { // function code } // part a inline void showMenu(menuItemType mList[], int listSize) { // function code } // part c inline void printCheck(menuItemType mList[], int listSize, int cList[], int cListLength) { // function code } inline bool isItemSelected(int cList[], int cListLength, int itemNo) { // function code } // part b inline void makeSelection(menuItemType mList[], int listSize, int cList[], int& cListLength) { // function code } Here's the breakfast.txt in case you need it: 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
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
This is my main.cpp, I need the functions.cpp to work with it, the teacher's aren't clarifying anything well, and its completly online.
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include "functions.cpp"
using namespace std;
//struct for menuItemType
struct menuItemType
{
string menuItem;
double menuPrice;
};
void getData(menuItemType menuList[]);
void showMenu(menuItemType menuList[], int x);
void printCheck(menuItemType menuList[], int menuOrder[], int x);
int main()
{
// Declare functions and variables
const int menuItems = 8;
menuItemType menuList[menuItems];
int menuOrder[menuItems] = {0};
int orderChoice = 0;
bool ordering = true;
int count = 0;
// Set the menu
getData(menuList);
// Order
showMenu(menuList, menuItems);
while(ordering)
{
cout << "Please enter the number for the item you would\n"
<< "like to order, or enter [0] to complete your order."
<< endl;
cin >> orderChoice;
if (orderChoice > 0 && orderChoice <= menuItems)
{
menuOrder[orderChoice - 1] += 1;
}
else
ordering = false;
}
printCheck(menuList, menuOrder, menuItems);
cin.ignore(2);
return 0;
}
void getData(menuItemType menuList[])
{
// Declare menuItemTypes
menuItemType plainEgg;
menuItemType baconEgg;
menuItemType muffin;
menuItemType frenchToast;
menuItemType fruitBasket;
menuItemType cereal;
menuItemType coffee;
menuItemType tea;
// Initialize menuItemTypes variables
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 x)
{
// Function variables
int count;
cout << "Welcome to Bob Evans!" << endl;
cout << "What would you to order?" << endl;
for(count = 0; count < x; count++)
{
cout << setw(2) << left << "[" << count + 1 << "]"
<< menuList[count].menuItem << '$'
<< menuList[count].menuPrice << endl;
}
}
void printCheck(menuItemType menuList[], int menuOrder[], int menuItems)
{
double checkTotal = 0;
double checkTax = 0;
const double TAX = .05;
cout << "Thanks for eating at Bob Evans!"
<< "Customer check: " << endl;
for(int i = 0; i < menuItems; i++)
{
if(menuOrder[i] > 0) {
cout << setprecision(3) << setw(10) << left << menuList[i].menuItem
<< '$' << (menuList[i].menuPrice * menuOrder[i]) << endl;
checkTotal += (menuList[i].menuPrice * menuOrder[i]);
}
}
checkTax = checkTotal * TAX;
checkTotal += checkTax;
cout << setw(14) << left << "Tax" << checkTax << endl
<< setw(14) << left << "Total" << checkTotal << endl;
}
This is the functions.cpp:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
// struct for menuItemType
// load data from file
inline void getData(ifstream& inFile, menuItemType mList[], int listSize)
{
// function code
}
// part a
inline void showMenu(menuItemType mList[], int listSize)
{
// function code
}
// part c
inline void printCheck(menuItemType mList[], int listSize,
int cList[], int cListLength)
{
// function code
}
inline bool isItemSelected(int cList[], int cListLength, int itemNo)
{
// function code
}
// part b
inline void makeSelection(menuItemType mList[], int listSize,
int cList[], int& cListLength)
{
// function code
}
Here's the breakfast.txt in case you need it:
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
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Knowledge Booster
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.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education