-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProduct.h
63 lines (57 loc) · 1.58 KB
/
Product.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef PRODUCT_H
#define PRODUCT_H
#include <iostream>
#include "ErrorState.h"
#include "iProduct.h"
namespace AMA
{
const int max_sku_length = 7;
const int max_unit_length = 10;
const int max_name_length = 75;
const double tax_rate = .13;
class Product : public iProduct
{
char prodType;
char prodSku[max_sku_length + 1];
char prodUnit[max_unit_length + 1];
char *prodName;
int prodQuantity;
int prodNeeded;
double prodPrice;
bool prodTax;
ErrorState error;
protected:
void name(const char *);
const char *name() const;
const char *sku() const;
const char *unit() const;
bool taxed() const;
double price() const;
double cost() const;
void message(const char *);
bool isClear() const;
public:
Product(const char = 'N');
Product(const char *, const char *, const char *, int = 0, bool = true, double = 0, int = 0);
Product(const Product &pass);
Product &operator=(const Product &);
~Product();
std::fstream &store(std::fstream &file, bool newLine = true) const;
std::fstream &load(std::fstream &file);
std::ostream &write(std::ostream &os, bool linear) const;
std::istream &read(std::istream &is);
bool operator==(const char *) const;
double total_cost() const;
void quantity(int);
bool isEmpty() const;
int qtyNeeded() const;
int quantity() const;
bool operator>(const char *) const;
bool operator>(const Product &) const;
int operator+=(int);
friend std::ostream &operator<<(std::ostream &, const Product &);
friend std::istream &operator>>(std::istream &, Product &);
friend double operator+=(double &, const Product &);
};
}
#endif