SlideShare a Scribd company logo
I just need to Item.cpp and item.h files please I'm having a bit of difficulty with it thanks. The
POS.h and Error.h is there for reference to help understand the solution.
This is the POS.h file!!!
const double TAX = 0.13;
const int MAX_SKU_LEN = 7;
const int MAX_NAME_LEN = 40;
const int MIN_YEAR = 2000;
const int MAX_YEAR = 2030;
const int MAX_STOCK_NUMBER = 99;
const int MAX_NO_ITEMS = 2000;
const int POS_LIST = 1;
const int POS_FORM = 2;
const char* ERROR_POS_SKU = "SKU too long";
const char* ERROR_POS_NAME = "Item name too long";
const char* ERROR_POS_PRICE = "Invalid price value";
const char* ERROR_POS_TAX = "Invalid tax status";
const char* ERROR_POS_QTY = "Invalid quantity value";
const char* ERROR_POS_STOCK = "Item out of stock";
const char* ERROR_POS_EMPTY = "Invalid Empty Item";
This is the Error class!!!
class Error{
char* m_message;
public:
Error();
Error(constchar* errorMessage);
Error& operator=(constchar* errorMessage);
operatorbool() const;
~Error();
void clear();
bool isClear() const;
constchar* message() const;
std::ostream& write(std::ostream& os);
};
std::ostream& operator<<(std::ostream&, Error& em);
}
# Milestone 3
Before starting milestone 3, add the following constant values to `POS.h` header file:
## Additional constant values
```text
MAX_NAME_LEN: 40
POS_LIST: 1
POS_FORM: 2
ERROR_POS_SKU: "SKU too long"
ERROR_POS_NAME: "Item name too long"
ERROR_POS_PRICE: "Invalid price value"
ERROR_POS_TAX: "Invalid tax status"
ERROR_POS_QTY: "Invalid quantity value"
ERROR_POS_STOCK: "Item out of stock"
ERROR_POS_EMPTY: "Invalid Empty Item"
``
For the third milestone of the project, you will create two classes: `PosIO` and `Item`. Milestone
3 is dependent on the `Error` class only. (You do not need the other classes created in milestones
1 and 2 at this stage)
## PosIO interface
Create a class called `PosIO` as an interface for console and file input and output operations.
This class will only define 4 pure virtual methods and a virtual empty destructor.
### Pure Virtual Methods
#### write
Receives and returns references of `ostream`. This method does not modify its owner.
#### read
Receives and returns references of `istream`.
#### save
Receives and returns references of `ofstream`. This method does not modify its owner.
#### load
Receives and returns references of `ifstream`.
### Insertion and Extraction operator overloads.
#### operator<<
Implement two insertion `operator<<` operator overloads that invoke the `write` and `save` pure
virtual methods to work with `ostream` and `ofstream`.
#### operator>>
Implement two extraction `operator>>` operator overloads that invoke the `read` and `load` pure
virtual methods to work with `istream` and `ifstream`.
Item Abstract class
Create a class called `Item` to encapsulate an Item to be sold by the POS system.
### Private Attributes
The Item class has the following mandatory attributes:
#### SKU
A C-string to keep an SKU code up to `MAX_SKU_LEN` characters.
#### Name
A dynamically allocated C-string to keep the name of the `Item` up to `MAX_NAME_LEN`
characters.
#### Price
A double value
#### Taxed
A boolean that indicates if the Item is taxable or not.
#### Quantity
An integer value for the stock number of the `Item`. (number of items in the shop)
#### diaplayType
An integer flag that can be either `POS_LIST` to display the Item in List mode or `POS_FORM`
to display the Item in Form mode.
### Protect Attribute
#### Error State
An Error object to keep the error status of the Item.
### Constructor
Item is instantiated using no arguments. In this case, an Item is set to an invalid Empty state (we
will refer to this as `empty` from now on).
### Rule of three
An Item can be copied or assigned to another item safely and is destroyed with no memory leak.
### Member operator overloads
#### operator==
Compares two Items and returns true if the `SKU` codes are identical.
#### operator>
Compares two items alphabetically based on their names.
#### opertor+=
Adds an integer value (right-hand operand) to the quantity and returns the quantity. If the sum of
the value and the quantity exceeds the `MAX_STOCK_NUMBER` then the quantity will be set
to `MAX_STOCK_NUMBER` and the Item error will be set to `ERROR_POS_QTY`.
#### operator-=
Reduces the quantity by the right-hand value and returns the quantity. If the value is more than
the quantity then the quantity will be set to zero and the Item error will be set to
`ERROR_POS_STOCK`.
#### bool type conversion
Returns the opposite of the status of the error attribute. This method does not modify the object.
### helper += operator overload
Overload the `operator+=` to receive a double reference as the left-hand operand and a constant
reference of Item as the right-hand operator. This operator should add the product of
[cost()](#cost-query) by [quantity()](#quantity-query) of the Item to the double operand and then
return the value.
### Member function (Methods)
This pure virtual method returns a character as the type indicator of the item in future
descendants of the Item. This method does not modify the object.
#### displayType
Receives an integer (`POS_LIST` or `POS_FORM`) and sets the corresponding attribute. This
method returns the reference of the current object.
#### cost query
Returns the cost of the Item; that is the price of the item (plus tax if the item is taxable). This
method does not modify the object.
#### quantity query
Returns the quantity of the Item. This method does not modify the object.
#### clear
Clears the error status of the object and then returns the reference of the current object.
### IO
Implement the four pure virtual methods of the base class as follows:
#### write
1. If in POS_LIST mode, it will print the object as follows:
```text
1234 |Screw Driver | 12.32| X | 90| 1252.94|
4567 |Tape Measure - Level| 112.30| | 10| 1123.00|
```
- Name: if longer than 20 characters, only the first 20 will be printed
- Taxed: if true `X` is printed or else space
- After the line is printed, no newlines are printed.
2. If in POS_FORM mode, it will print as follows:
```text
=============v
Name: Screw Driver
Sku: 1234
Price: 12.32
Price + tax: 13.92
Stock Qty: 90
=============v
Name: Tape Measure - Level - Laser - Combo
Sku: 4567
Price: 112.30
Price + tax: N/A
Stock Qty: 10
```
- At the end, a newline is printed.
3. If the Item is erroneous only the error object is printed (with no newline after).
In the end, the ostream reference is returned.
#### save
Save the data in a comma-separated format as follows:
First, the [itemType](#itemtype-query) is printed and then all the attributes are saved separated
by commas. No newline is saved at the end.
In the following example, we assume the derived class's [itemType](#itemtype-query) function is
returning 'T'.
```text
T,1234,Screw Driver,12.32,1,89
T,4567,Tape Measure - Level - Laser - Combo,112.30,0,9
```
If the Item is erroneous the error object is inserted into `cerr` and not the ofstream (with a
newline after).
In the end, the ofstream reference is returned.
#### read
Performs fool-proof data entry.
The attributes are read in the following order:
SKU, Name, Price, Taxed or not and Quantity.
After each data entry, the value is validated, if invalid the [proper error message](#additional-
constant-values) is printed and in the next line at the prompt (`>`) the value is re-entered. This
repeats until a valid value is entered. See [Execution Sample](#execution-sample).
In the end, the reference of istream is returned.
```text
Sku
> 12345
Name
> Hammer
Price
> 23.99
Taxed?
(Y)es/(N)o: y
Quantity
> 35
```
#### load
First, the error status will be [clear](#clear-1)ed
Then reads all the values from the ifstream object in a comma-separated format (assuming the
data begins with the SKU) in local variables (not directly into the attributes of the item).
If after the reading the ifstream is not in a failure state, it will validate the values one by one and
if any of the validation fails, the error message is set to the proper message and validation stops.
At the end of the validation process, if there is no error, the attributes are set to the validated
values.
The reference of the ifstream object is returned at the end.
#### billPrint
This function will receive and return the ostream object.
The bill print function will only print the Name, taxed price, and if the item is taxed or not:
```text
| Screw Driver | 13.92 | T |
| Tape Measure - Level| 112.30 | |
```
- Name: only the first 20 characters are printed
- Taxed: if the item is taxed, `T` and otherwise, a space is printed.

More Related Content

Similar to I just need to Item.cpp and item.h files please Im having a bit of .pdf

Should be in JavaInterface Worker should extend Serializable from .pdf
Should be in JavaInterface Worker should extend Serializable from .pdfShould be in JavaInterface Worker should extend Serializable from .pdf
Should be in JavaInterface Worker should extend Serializable from .pdffashionscollect
 
Please solve the following problem using C++- Thank you Instructions-.docx
Please solve the following problem using C++- Thank you Instructions-.docxPlease solve the following problem using C++- Thank you Instructions-.docx
Please solve the following problem using C++- Thank you Instructions-.docxPeterlqELawrenceb
 
A Spin-off: CryEngine 3 SDK Checked with CppCat
A Spin-off: CryEngine 3 SDK Checked with CppCatA Spin-off: CryEngine 3 SDK Checked with CppCat
A Spin-off: CryEngine 3 SDK Checked with CppCatAndrey Karpov
 
Paca java script slid
Paca java script slidPaca java script slid
Paca java script slidpacatarpit
 
Below is my code- I have an error that I still have difficulty figurin.pdf
Below is my code- I have an error that I still have difficulty figurin.pdfBelow is my code- I have an error that I still have difficulty figurin.pdf
Below is my code- I have an error that I still have difficulty figurin.pdfarmanuelraj
 
Analyzing Firebird 3.0
Analyzing Firebird 3.0Analyzing Firebird 3.0
Analyzing Firebird 3.0PVS-Studio
 
Checking the World of Warcraft CMaNGOS open source server
Checking the World of Warcraft CMaNGOS open source serverChecking the World of Warcraft CMaNGOS open source server
Checking the World of Warcraft CMaNGOS open source serverPVS-Studio
 
A Spin-off: Firebird Checked by PVS-Studio
A Spin-off: Firebird Checked by PVS-StudioA Spin-off: Firebird Checked by PVS-Studio
A Spin-off: Firebird Checked by PVS-StudioAndrey Karpov
 
Checking Wine with PVS-Studio and Clang Static Analyzer
Checking Wine with PVS-Studio and Clang Static AnalyzerChecking Wine with PVS-Studio and Clang Static Analyzer
Checking Wine with PVS-Studio and Clang Static AnalyzerAndrey Karpov
 
A fresh eye on Oracle VM VirtualBox
A fresh eye on Oracle VM VirtualBoxA fresh eye on Oracle VM VirtualBox
A fresh eye on Oracle VM VirtualBoxPVS-Studio
 
Objectives 1. using indirect addressing 2. passing parameters.pdf
Objectives 1. using indirect addressing 2. passing parameters.pdfObjectives 1. using indirect addressing 2. passing parameters.pdf
Objectives 1. using indirect addressing 2. passing parameters.pdffcsondhiindia
 
How to generate a 100+ page website using parameterisation in R
How to generate a 100+ page website using parameterisation in RHow to generate a 100+ page website using parameterisation in R
How to generate a 100+ page website using parameterisation in RPaul Bradshaw
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxamrit47
 

Similar to I just need to Item.cpp and item.h files please Im having a bit of .pdf (20)

Should be in JavaInterface Worker should extend Serializable from .pdf
Should be in JavaInterface Worker should extend Serializable from .pdfShould be in JavaInterface Worker should extend Serializable from .pdf
Should be in JavaInterface Worker should extend Serializable from .pdf
 
C code examples
C code examplesC code examples
C code examples
 
Please solve the following problem using C++- Thank you Instructions-.docx
Please solve the following problem using C++- Thank you Instructions-.docxPlease solve the following problem using C++- Thank you Instructions-.docx
Please solve the following problem using C++- Thank you Instructions-.docx
 
A Spin-off: CryEngine 3 SDK Checked with CppCat
A Spin-off: CryEngine 3 SDK Checked with CppCatA Spin-off: CryEngine 3 SDK Checked with CppCat
A Spin-off: CryEngine 3 SDK Checked with CppCat
 
Paca java script slid
Paca java script slidPaca java script slid
Paca java script slid
 
C important questions
C important questionsC important questions
C important questions
 
Below is my code- I have an error that I still have difficulty figurin.pdf
Below is my code- I have an error that I still have difficulty figurin.pdfBelow is my code- I have an error that I still have difficulty figurin.pdf
Below is my code- I have an error that I still have difficulty figurin.pdf
 
Analyzing Firebird 3.0
Analyzing Firebird 3.0Analyzing Firebird 3.0
Analyzing Firebird 3.0
 
Analyzing Firebird 3.0
Analyzing Firebird 3.0Analyzing Firebird 3.0
Analyzing Firebird 3.0
 
C++ programming
C++ programmingC++ programming
C++ programming
 
Checking the World of Warcraft CMaNGOS open source server
Checking the World of Warcraft CMaNGOS open source serverChecking the World of Warcraft CMaNGOS open source server
Checking the World of Warcraft CMaNGOS open source server
 
Web Technology_10.ppt
Web Technology_10.pptWeb Technology_10.ppt
Web Technology_10.ppt
 
A Spin-off: Firebird Checked by PVS-Studio
A Spin-off: Firebird Checked by PVS-StudioA Spin-off: Firebird Checked by PVS-Studio
A Spin-off: Firebird Checked by PVS-Studio
 
Checking Wine with PVS-Studio and Clang Static Analyzer
Checking Wine with PVS-Studio and Clang Static AnalyzerChecking Wine with PVS-Studio and Clang Static Analyzer
Checking Wine with PVS-Studio and Clang Static Analyzer
 
A fresh eye on Oracle VM VirtualBox
A fresh eye on Oracle VM VirtualBoxA fresh eye on Oracle VM VirtualBox
A fresh eye on Oracle VM VirtualBox
 
Objectives 1. using indirect addressing 2. passing parameters.pdf
Objectives 1. using indirect addressing 2. passing parameters.pdfObjectives 1. using indirect addressing 2. passing parameters.pdf
Objectives 1. using indirect addressing 2. passing parameters.pdf
 
How to generate a 100+ page website using parameterisation in R
How to generate a 100+ page website using parameterisation in RHow to generate a 100+ page website using parameterisation in R
How to generate a 100+ page website using parameterisation in R
 
Functional Web Development using Elm
Functional Web Development using ElmFunctional Web Development using Elm
Functional Web Development using Elm
 
Chapter 1 .pptx
Chapter 1 .pptxChapter 1 .pptx
Chapter 1 .pptx
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
 

More from allurafashions98

Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf
 Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf
Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdfallurafashions98
 
Current Attempt in Progress Waterway Company uses a periodic inventor.pdf
 Current Attempt in Progress Waterway Company uses a periodic inventor.pdf Current Attempt in Progress Waterway Company uses a periodic inventor.pdf
Current Attempt in Progress Waterway Company uses a periodic inventor.pdfallurafashions98
 
Current Attempt in Progress The comparative balance.pdf
 Current Attempt in Progress The comparative balance.pdf Current Attempt in Progress The comparative balance.pdf
Current Attempt in Progress The comparative balance.pdfallurafashions98
 
Current Attempt in Progress Novaks Market recorded the following eve.pdf
 Current Attempt in Progress Novaks Market recorded the following eve.pdf Current Attempt in Progress Novaks Market recorded the following eve.pdf
Current Attempt in Progress Novaks Market recorded the following eve.pdfallurafashions98
 
Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf
 Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf
Current Attempt in Progress Ivanhoe Corporation reported the followin.pdfallurafashions98
 
Define a class called Disk with two member variables, an int called.pdf
 Define a class called Disk with two member variables, an int called.pdf Define a class called Disk with two member variables, an int called.pdf
Define a class called Disk with two member variables, an int called.pdfallurafashions98
 
Define to be the median of the Exponential () distribution. That is,.pdf
 Define  to be the median of the Exponential () distribution. That is,.pdf Define  to be the median of the Exponential () distribution. That is,.pdf
Define to be the median of the Exponential () distribution. That is,.pdfallurafashions98
 
Dedewine the bridthenes tar this test Choose the conist answet below .pdf
 Dedewine the bridthenes tar this test Choose the conist answet below .pdf Dedewine the bridthenes tar this test Choose the conist answet below .pdf
Dedewine the bridthenes tar this test Choose the conist answet below .pdfallurafashions98
 
Davenport Incorporated has two divisions, Howard and Jones. The f.pdf
 Davenport Incorporated has two divisions, Howard and Jones. The f.pdf Davenport Incorporated has two divisions, Howard and Jones. The f.pdf
Davenport Incorporated has two divisions, Howard and Jones. The f.pdfallurafashions98
 
Data tableRequirements 1. Prepare the income statement for the mon.pdf
 Data tableRequirements 1. Prepare the income statement for the mon.pdf Data tableRequirements 1. Prepare the income statement for the mon.pdf
Data tableRequirements 1. Prepare the income statement for the mon.pdfallurafashions98
 
Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf
 Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf
Current Attempt in Progress Items from Oriole Companys budget for Ma.pdfallurafashions98
 
Data tableAfter researching the competitors of EJH Enterprises, yo.pdf
 Data tableAfter researching the competitors of EJH Enterprises, yo.pdf Data tableAfter researching the competitors of EJH Enterprises, yo.pdf
Data tableAfter researching the competitors of EJH Enterprises, yo.pdfallurafashions98
 
Current Attempt in Progress If a qualitative variable has c categ.pdf
 Current Attempt in Progress If a qualitative variable has  c  categ.pdf Current Attempt in Progress If a qualitative variable has  c  categ.pdf
Current Attempt in Progress If a qualitative variable has c categ.pdfallurafashions98
 
Data tableData tableThe figures to the right show the BOMs for .pdf
 Data tableData tableThe figures to the right show the BOMs for .pdf Data tableData tableThe figures to the right show the BOMs for .pdf
Data tableData tableThe figures to the right show the BOMs for .pdfallurafashions98
 
Data table Requirements 1. Compute the product cost per meal produced.pdf
 Data table Requirements 1. Compute the product cost per meal produced.pdf Data table Requirements 1. Compute the product cost per meal produced.pdf
Data table Requirements 1. Compute the product cost per meal produced.pdfallurafashions98
 
Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf
 Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf
Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdfallurafashions98
 
Daniel, age 38 , is single and has the following income and exnencac .pdf
 Daniel, age 38 , is single and has the following income and exnencac .pdf Daniel, age 38 , is single and has the following income and exnencac .pdf
Daniel, age 38 , is single and has the following income and exnencac .pdfallurafashions98
 
Danny Anderson admired his wifes success at selling scarves at local.pdf
 Danny Anderson admired his wifes success at selling scarves at local.pdf Danny Anderson admired his wifes success at selling scarves at local.pdf
Danny Anderson admired his wifes success at selling scarves at local.pdfallurafashions98
 
CX Enterprises has the following expected dividends $1.05 in one yea.pdf
 CX Enterprises has the following expected dividends $1.05 in one yea.pdf CX Enterprises has the following expected dividends $1.05 in one yea.pdf
CX Enterprises has the following expected dividends $1.05 in one yea.pdfallurafashions98
 
Daring the financial crisis an the end of the firs decade of the 2000.pdf
 Daring the financial crisis an the end of the firs decade of the 2000.pdf Daring the financial crisis an the end of the firs decade of the 2000.pdf
Daring the financial crisis an the end of the firs decade of the 2000.pdfallurafashions98
 

More from allurafashions98 (20)

Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf
 Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf
Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf
 
Current Attempt in Progress Waterway Company uses a periodic inventor.pdf
 Current Attempt in Progress Waterway Company uses a periodic inventor.pdf Current Attempt in Progress Waterway Company uses a periodic inventor.pdf
Current Attempt in Progress Waterway Company uses a periodic inventor.pdf
 
Current Attempt in Progress The comparative balance.pdf
 Current Attempt in Progress The comparative balance.pdf Current Attempt in Progress The comparative balance.pdf
Current Attempt in Progress The comparative balance.pdf
 
Current Attempt in Progress Novaks Market recorded the following eve.pdf
 Current Attempt in Progress Novaks Market recorded the following eve.pdf Current Attempt in Progress Novaks Market recorded the following eve.pdf
Current Attempt in Progress Novaks Market recorded the following eve.pdf
 
Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf
 Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf
Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf
 
Define a class called Disk with two member variables, an int called.pdf
 Define a class called Disk with two member variables, an int called.pdf Define a class called Disk with two member variables, an int called.pdf
Define a class called Disk with two member variables, an int called.pdf
 
Define to be the median of the Exponential () distribution. That is,.pdf
 Define  to be the median of the Exponential () distribution. That is,.pdf Define  to be the median of the Exponential () distribution. That is,.pdf
Define to be the median of the Exponential () distribution. That is,.pdf
 
Dedewine the bridthenes tar this test Choose the conist answet below .pdf
 Dedewine the bridthenes tar this test Choose the conist answet below .pdf Dedewine the bridthenes tar this test Choose the conist answet below .pdf
Dedewine the bridthenes tar this test Choose the conist answet below .pdf
 
Davenport Incorporated has two divisions, Howard and Jones. The f.pdf
 Davenport Incorporated has two divisions, Howard and Jones. The f.pdf Davenport Incorporated has two divisions, Howard and Jones. The f.pdf
Davenport Incorporated has two divisions, Howard and Jones. The f.pdf
 
Data tableRequirements 1. Prepare the income statement for the mon.pdf
 Data tableRequirements 1. Prepare the income statement for the mon.pdf Data tableRequirements 1. Prepare the income statement for the mon.pdf
Data tableRequirements 1. Prepare the income statement for the mon.pdf
 
Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf
 Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf
Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf
 
Data tableAfter researching the competitors of EJH Enterprises, yo.pdf
 Data tableAfter researching the competitors of EJH Enterprises, yo.pdf Data tableAfter researching the competitors of EJH Enterprises, yo.pdf
Data tableAfter researching the competitors of EJH Enterprises, yo.pdf
 
Current Attempt in Progress If a qualitative variable has c categ.pdf
 Current Attempt in Progress If a qualitative variable has  c  categ.pdf Current Attempt in Progress If a qualitative variable has  c  categ.pdf
Current Attempt in Progress If a qualitative variable has c categ.pdf
 
Data tableData tableThe figures to the right show the BOMs for .pdf
 Data tableData tableThe figures to the right show the BOMs for .pdf Data tableData tableThe figures to the right show the BOMs for .pdf
Data tableData tableThe figures to the right show the BOMs for .pdf
 
Data table Requirements 1. Compute the product cost per meal produced.pdf
 Data table Requirements 1. Compute the product cost per meal produced.pdf Data table Requirements 1. Compute the product cost per meal produced.pdf
Data table Requirements 1. Compute the product cost per meal produced.pdf
 
Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf
 Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf
Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf
 
Daniel, age 38 , is single and has the following income and exnencac .pdf
 Daniel, age 38 , is single and has the following income and exnencac .pdf Daniel, age 38 , is single and has the following income and exnencac .pdf
Daniel, age 38 , is single and has the following income and exnencac .pdf
 
Danny Anderson admired his wifes success at selling scarves at local.pdf
 Danny Anderson admired his wifes success at selling scarves at local.pdf Danny Anderson admired his wifes success at selling scarves at local.pdf
Danny Anderson admired his wifes success at selling scarves at local.pdf
 
CX Enterprises has the following expected dividends $1.05 in one yea.pdf
 CX Enterprises has the following expected dividends $1.05 in one yea.pdf CX Enterprises has the following expected dividends $1.05 in one yea.pdf
CX Enterprises has the following expected dividends $1.05 in one yea.pdf
 
Daring the financial crisis an the end of the firs decade of the 2000.pdf
 Daring the financial crisis an the end of the firs decade of the 2000.pdf Daring the financial crisis an the end of the firs decade of the 2000.pdf
Daring the financial crisis an the end of the firs decade of the 2000.pdf
 

Recently uploaded

Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesRased Khan
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticspragatimahajan3
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptxmansk2
 
An Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxAn Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxCeline George
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringDenish Jangid
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryEugene Lysak
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...Nguyen Thanh Tu Collection
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resourcesdimpy50
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxJenilouCasareno
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxricssacare
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsCol Mukteshwar Prasad
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTechSoup
 
Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxShibin Azad
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...Nguyen Thanh Tu Collection
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXMIRIAMSALINAS13
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportAvinash Rai
 

Recently uploaded (20)

Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceutics
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
An Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxAn Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptx
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. Henry
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
 
Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptx
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 

I just need to Item.cpp and item.h files please Im having a bit of .pdf

  • 1. I just need to Item.cpp and item.h files please I'm having a bit of difficulty with it thanks. The POS.h and Error.h is there for reference to help understand the solution. This is the POS.h file!!! const double TAX = 0.13; const int MAX_SKU_LEN = 7; const int MAX_NAME_LEN = 40; const int MIN_YEAR = 2000; const int MAX_YEAR = 2030; const int MAX_STOCK_NUMBER = 99; const int MAX_NO_ITEMS = 2000; const int POS_LIST = 1; const int POS_FORM = 2; const char* ERROR_POS_SKU = "SKU too long"; const char* ERROR_POS_NAME = "Item name too long"; const char* ERROR_POS_PRICE = "Invalid price value"; const char* ERROR_POS_TAX = "Invalid tax status"; const char* ERROR_POS_QTY = "Invalid quantity value"; const char* ERROR_POS_STOCK = "Item out of stock"; const char* ERROR_POS_EMPTY = "Invalid Empty Item"; This is the Error class!!! class Error{ char* m_message; public: Error(); Error(constchar* errorMessage); Error& operator=(constchar* errorMessage); operatorbool() const; ~Error(); void clear(); bool isClear() const; constchar* message() const; std::ostream& write(std::ostream& os); }; std::ostream& operator<<(std::ostream&, Error& em);
  • 2. } # Milestone 3 Before starting milestone 3, add the following constant values to `POS.h` header file: ## Additional constant values ```text MAX_NAME_LEN: 40 POS_LIST: 1 POS_FORM: 2 ERROR_POS_SKU: "SKU too long" ERROR_POS_NAME: "Item name too long" ERROR_POS_PRICE: "Invalid price value" ERROR_POS_TAX: "Invalid tax status" ERROR_POS_QTY: "Invalid quantity value" ERROR_POS_STOCK: "Item out of stock" ERROR_POS_EMPTY: "Invalid Empty Item" `` For the third milestone of the project, you will create two classes: `PosIO` and `Item`. Milestone 3 is dependent on the `Error` class only. (You do not need the other classes created in milestones 1 and 2 at this stage) ## PosIO interface Create a class called `PosIO` as an interface for console and file input and output operations. This class will only define 4 pure virtual methods and a virtual empty destructor. ### Pure Virtual Methods #### write Receives and returns references of `ostream`. This method does not modify its owner. #### read Receives and returns references of `istream`. #### save Receives and returns references of `ofstream`. This method does not modify its owner. #### load
  • 3. Receives and returns references of `ifstream`. ### Insertion and Extraction operator overloads. #### operator<< Implement two insertion `operator<<` operator overloads that invoke the `write` and `save` pure virtual methods to work with `ostream` and `ofstream`. #### operator>> Implement two extraction `operator>>` operator overloads that invoke the `read` and `load` pure virtual methods to work with `istream` and `ifstream`. Item Abstract class Create a class called `Item` to encapsulate an Item to be sold by the POS system. ### Private Attributes The Item class has the following mandatory attributes: #### SKU A C-string to keep an SKU code up to `MAX_SKU_LEN` characters. #### Name A dynamically allocated C-string to keep the name of the `Item` up to `MAX_NAME_LEN` characters. #### Price A double value #### Taxed A boolean that indicates if the Item is taxable or not. #### Quantity An integer value for the stock number of the `Item`. (number of items in the shop) #### diaplayType An integer flag that can be either `POS_LIST` to display the Item in List mode or `POS_FORM` to display the Item in Form mode. ### Protect Attribute #### Error State An Error object to keep the error status of the Item. ### Constructor Item is instantiated using no arguments. In this case, an Item is set to an invalid Empty state (we
  • 4. will refer to this as `empty` from now on). ### Rule of three An Item can be copied or assigned to another item safely and is destroyed with no memory leak. ### Member operator overloads #### operator== Compares two Items and returns true if the `SKU` codes are identical. #### operator> Compares two items alphabetically based on their names. #### opertor+= Adds an integer value (right-hand operand) to the quantity and returns the quantity. If the sum of the value and the quantity exceeds the `MAX_STOCK_NUMBER` then the quantity will be set to `MAX_STOCK_NUMBER` and the Item error will be set to `ERROR_POS_QTY`. #### operator-= Reduces the quantity by the right-hand value and returns the quantity. If the value is more than the quantity then the quantity will be set to zero and the Item error will be set to `ERROR_POS_STOCK`. #### bool type conversion Returns the opposite of the status of the error attribute. This method does not modify the object. ### helper += operator overload Overload the `operator+=` to receive a double reference as the left-hand operand and a constant reference of Item as the right-hand operator. This operator should add the product of [cost()](#cost-query) by [quantity()](#quantity-query) of the Item to the double operand and then return the value. ### Member function (Methods) This pure virtual method returns a character as the type indicator of the item in future descendants of the Item. This method does not modify the object. #### displayType Receives an integer (`POS_LIST` or `POS_FORM`) and sets the corresponding attribute. This method returns the reference of the current object.
  • 5. #### cost query Returns the cost of the Item; that is the price of the item (plus tax if the item is taxable). This method does not modify the object. #### quantity query Returns the quantity of the Item. This method does not modify the object. #### clear Clears the error status of the object and then returns the reference of the current object. ### IO Implement the four pure virtual methods of the base class as follows: #### write 1. If in POS_LIST mode, it will print the object as follows: ```text 1234 |Screw Driver | 12.32| X | 90| 1252.94| 4567 |Tape Measure - Level| 112.30| | 10| 1123.00| ``` - Name: if longer than 20 characters, only the first 20 will be printed - Taxed: if true `X` is printed or else space - After the line is printed, no newlines are printed. 2. If in POS_FORM mode, it will print as follows: ```text =============v Name: Screw Driver Sku: 1234 Price: 12.32 Price + tax: 13.92 Stock Qty: 90 =============v Name: Tape Measure - Level - Laser - Combo Sku: 4567 Price: 112.30 Price + tax: N/A
  • 6. Stock Qty: 10 ``` - At the end, a newline is printed. 3. If the Item is erroneous only the error object is printed (with no newline after). In the end, the ostream reference is returned. #### save Save the data in a comma-separated format as follows: First, the [itemType](#itemtype-query) is printed and then all the attributes are saved separated by commas. No newline is saved at the end. In the following example, we assume the derived class's [itemType](#itemtype-query) function is returning 'T'. ```text T,1234,Screw Driver,12.32,1,89 T,4567,Tape Measure - Level - Laser - Combo,112.30,0,9 ``` If the Item is erroneous the error object is inserted into `cerr` and not the ofstream (with a newline after). In the end, the ofstream reference is returned. #### read Performs fool-proof data entry. The attributes are read in the following order: SKU, Name, Price, Taxed or not and Quantity. After each data entry, the value is validated, if invalid the [proper error message](#additional- constant-values) is printed and in the next line at the prompt (`>`) the value is re-entered. This repeats until a valid value is entered. See [Execution Sample](#execution-sample). In the end, the reference of istream is returned.
  • 7. ```text Sku > 12345 Name > Hammer Price > 23.99 Taxed? (Y)es/(N)o: y Quantity > 35 ``` #### load First, the error status will be [clear](#clear-1)ed Then reads all the values from the ifstream object in a comma-separated format (assuming the data begins with the SKU) in local variables (not directly into the attributes of the item). If after the reading the ifstream is not in a failure state, it will validate the values one by one and if any of the validation fails, the error message is set to the proper message and validation stops. At the end of the validation process, if there is no error, the attributes are set to the validated values. The reference of the ifstream object is returned at the end. #### billPrint This function will receive and return the ostream object. The bill print function will only print the Name, taxed price, and if the item is taxed or not: ```text | Screw Driver | 13.92 | T | | Tape Measure - Level| 112.30 | | ```
  • 8. - Name: only the first 20 characters are printed - Taxed: if the item is taxed, `T` and otherwise, a space is printed.