-
Notifications
You must be signed in to change notification settings - Fork 0
/
Product.cpp
46 lines (38 loc) · 1.24 KB
/
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
/*********************************************************************
** Author: Jordan Hamilton
** Date: 03/15/2018
** Description: This implements a class representing a product. Data
** members represent the product's code, title, description, price,
** and quantity in stock. A method decreases the quantity in stock
** by 1.
*********************************************************************/
#include "Product.hpp"
Product::Product(std::string idCodeIn, std::string titleIn, std::string descriptionIn, double priceIn, int quantityIn) {
idCode = idCodeIn;
title = titleIn;
description = descriptionIn;
price = priceIn;
quantityAvailable = quantityIn;
}
std::string Product::getIdCode() {
return idCode;
}
std::string Product::getTitle() {
return title;
}
std::string Product::getDescription() {
return description;
}
double Product::getPrice() {
return price;
}
int Product::getQuantityAvailable() {
return quantityAvailable;
}
/*********************************************************************
** Description: Decreases the value of the quantityAvailable data
** member by 1 when called.
*********************************************************************/
void Product::decreaseQuantity() {
quantityAvailable--;
}