Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have the Bakery.H file and the main.cpp file already created and for some reason I am getting a error in line 1 3 1
I have the Bakery.H file and the main.cpp file already created and for some reason I am getting a error in line : cout "Total Cost: $ setw getTotalCost endl; stating "Total Cos'getTotalCost' was not declared in this scope
However it was declared. Can you please take a look at the program and tell me why it is telling me this?
Thank you in advance.
#include "Bakery.h Pulls from the header file
#include "main.cpp Pulls from main.cpp file in folder
#include
#include
#include For changing console colors
using namespace std;
Default constructor
Bakery::Bakery : pastryID quantity price
Parameterized constructor
Bakery::Bakeryint id int quan, double pri : pastryIDid quantityquan pricepri
void Bakery::setPastryIDint id
if id
pastryID id;
else Using cerr for error messages throughout code.
cerr "Error: Pastry ID cannot be negative." endl;
void Bakery::setQuantityint quan
if quan
quantity quan;
else
cerr "Error: Quantity cannot be negative." endl;
void Bakery::setPricedouble pri
if pri
price pri;
else
cerr "Error: Price cannot be negative." endl;
int Bakery::getPastryID const
return pastryID;
int Bakery::getQuantity const
return quantity;
The function obtains the price per unit of the bakery items.
double Bakery::getPrice const
return price; Will return the price per unit of the items.
Calculates the total of the bakery items
double Bakery::getTotalCost const
Caclualtes the total by multiplying the quantity with the price per unit.
return quantity price;
void displayBakeryInventoryint pastryID, int quantity, double price
HANDLE hConsole GetStdHandleSTDOUTPUTHANDLE;
Program description
cout
t Welcome to the Bakery calculator!
;
cout t
;
cout
;
cout ~ Bakery Inventory ~
;
cout
;
cout This program will allow you to enter the pastry ID
;
cout the quantity and the price per pastry to be inventoried
;
cout which will then tell you the total price of the item by
;
cout bulk.
;
cout
;
Changing letter color to red
SetConsoleTextAttributehConsole;
cout
t BAKERY INVENTORY
endl;
cout t
;
Resetting letter color to white
SetConsoleTextAttributehConsole;
cout "Pastry ID: setw pastryID endl;
cout "Quantity:" setw quantity endl;
cout "Price per unit: $ setw fixed setprecision price endl;
cout "Total Cost: $ setw getTotalCost endl;
Changing letter color to red
SetConsoleTextAttributehConsole;
cout endl;
Resetting color to white
SetConsoleTextAttributehConsole;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started