-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomer.cpp
45 lines (38 loc) · 1.49 KB
/
Customer.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
/*********************************************************************
** Author: Jordan Hamilton
** Date: 03/15/2018
** Description: This implements a class representing a customer. Data
** members represent the customer's shopping cart, name, account ID,
** and whether or not he or she is a premium member of a store.
** Methods add products to the customer's cart by product code, and
** remove all items from the cart.
*********************************************************************/
#include "Customer.hpp"
Customer::Customer(std::string nameIn, std::string accountIDIn, bool premiumMemberIn) {
name = nameIn;
accountID = accountIDIn;
premiumMember = premiumMemberIn;
}
std::string Customer::getAccountID() {
return accountID;
}
std::vector<std::string> Customer::getCart() {
return cart;
}
/*********************************************************************
** Description: Adds a string representing a product code to the end
** of the cart vector.
*********************************************************************/
void Customer::addProductToCart(std::string idCodeIn) {
cart.push_back(idCodeIn);
}
bool Customer::isPremiumMember() {
return premiumMember;
}
/*********************************************************************
** Description: Empties the cart vector using the vector's built-in
** clear function.
*********************************************************************/
void Customer::emptyCart() {
cart.clear();
}