Question: POS System C++ Need help using between header, cpp and main file. I'm not sure how to implement this. The general idea I have down
POS System C++ Need help using between header, cpp and main file. I'm not sure how to implement this. The general idea I have down but not sure how to get from the initial selection menu back to the first customer selection menu. I've attatched the following code below. I don't want everything on the main file if that makes sense I want it to pull the functions and such from the header/cpp folders instead. Here's what I have so far.
Main.cpp File:
void sale() { cout << " 1. Bakery"; cout << " 2. Fruits"; cout << " 3. Grocery"; cout << " 4. Vegetables"; cout << " Enter your choice : "; int choice; cin >> choice; int amount = 0; if (choice == 1) { BakeryMenu(); } if (choice == 2) { amount = 200; pay(); } if (choice == 3) { amount = 300; pay(); } if (choice == 4) { amount = 400; pay(); }
}
-------- This is what the "customer will see for their options-----------
BakeryMenu.h File
#pragma once class BakeryMenu { private: int Bakery; public: BakeryMenu(int b); int getBakery(); };
-----------this is the wrong function I'm pretty sure I just don't know what to put here-------------
BakeryMenu.cpp File
#include
double Breads = 5.23, Rolls = 2.58, Biscuits = 3.87, Cakes = 1.89, Tortillas = 3.63, Pastries = 5.75; //declare the price of the items double qty; //declaring the quantity int pc1Qty, pc2Qty, pc5Qty, pc6Qty; //separating the otehr products so they can be used as whole numbers double p1total = 0, p2total = 0, p3total = 0, p4total = 0, p5total = 0, p6total = 0, p7total = 0, p8total = 0, Gtotal = 0; //declare the quantity of the product and grand gtotal for the calcualte the total price double p3qty = 0, p4qty = 0; //to display the quantity of each product
void BakeryMenu() { cout << "---------------------------------"; cout << "Bakery"; cout << "---------------------------------"; cout << " 1 Breads $5.23/pc"; cout << " 2 Rolls $2.58/pc"; cout << " 3 Biscuits $3.87/lb"; cout << " 4 Cakes $1.89/lb"; cout << " 5 Tortillas $3.63/pc"; cout << " 6 Pastries $5.75/lb"; } //function for the product choosen by the user and function void addItem(char selection) { double total = 0.0; qty; cout << "Enter Qty: "; cin >> qty;
if (selection == '1') { total = 2.95 * qty; cout << "Added to order" << endl; p1total += total; pc1Qty += qty; Gtotal += p1total; } else if (selection == '2') { total = 12.78 * qty; cout << "Added to order" << endl; p2total += total; pc2Qty += qty; Gtotal += p2total; } else if (selection == '3') { total = 20.17 * qty; cout << "Added to order" << endl; p3total += total; p3qty += qty; Gtotal += p3total; } else if (selection == '4') { total = 8.56 * qty; cout << "Added to order" << endl; p4total += total; p4qty += qty; Gtotal += p4total; } else if (selection == '5') { total = 4.14 * qty; cout << "Added to order" << endl; p5total += total; pc5Qty += qty; Gtotal += p5total; } else if (selection == '6') { total = 3.76 * qty; cout << "Added to order" << endl; p6total += total; pc6Qty += qty; Gtotal += p6total; } } //selection function void processMenuSelection(char selection) { if (selection == '1') addItem(selection);
else if (selection == '2') addItem(selection);
else if (selection == '3') addItem(selection);
else if (selection == '4') addItem(selection);
else if (selection == '5') addItem(selection);
else if (selection == '6') addItem(selection); }
Once this works properly I believe it's just copying and pasting everything just changing the values and such accordingly. Any questions please ask. Thank you!
Note: I'm getting this error as well when trying to run in visual studio: C512 'BakeryMenu':no appropriate default constructor available
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
