-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduct.cpp
47 lines (37 loc) · 890 Bytes
/
product.cpp
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
#include <iostream>
#include <string.h>
#include "product.h"
using namespace std;
Product::Product(int qty, float price, char *name){
setItemName(name);
setPrice(price);
setQuantity(qty);
}
//Product::Product(Product *prod){
// setItemName(prod->getItemName());
// setPrice(prod->getPrice());
// setQuantity(prod->getQuantity());
//}
char * Product::getItemName(){
return itemName;
}
float Product::getPrice(){
return price;
}
int Product::getQuantity(){
return quantity;
}
void Product::setItemName(char * name){
strcpy(itemName, name);
}
void Product::setPrice(float prce){
price = prce;
}
void Product::setQuantity(int qty){
quantity = qty;
}
void Product::display(){
cout << "Product name:" << getItemName()<< endl;
cout << "Product price:" << getPrice()<< endl;
cout << "Product quantity:" << getQuantity() << endl;
}