-
Notifications
You must be signed in to change notification settings - Fork 0
/
storeMain.cpp
71 lines (51 loc) · 2.3 KB
/
storeMain.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
using std::cout;
using std::endl;
#include "Store.hpp"
int main() {
Customer newGuy("Bro", "8675308", false);
Customer newGirl("Jenny", "8675309", true);
Product spardex("1001", "Spardex", "Stretches for dayyyyys", 10.02, 5);
Product jammies("1002", "Jammies", "Oh so cozy", 3.01, 5);
Store amazon;
amazon.addMember(&newGuy);
Customer* ptrNewGirl = &newGirl;
amazon.addMember(ptrNewGirl);
amazon.addProduct(&spardex);
Product* ptrJammies = &jammies;
amazon.addProduct(ptrJammies);
cout << endl << "Searching for a \"Cozy\" product: " << endl;
amazon.productSearch("Cozy");
cout << endl << "Adding products to member cart: " << endl;
cout << amazon.addProductToMemberCart("1001", "8675308") << endl;
cout << amazon.addProductToMemberCart("1001", "8675308") << endl;
cout << amazon.addProductToMemberCart("1002", "8675308") << endl;
cout << amazon.addProductToMemberCart("1002", "8675308") << endl;
cout << amazon.addProductToMemberCart("1002", "8675308") << endl;
cout << endl << "Check-out time! " << amazon.checkOutMember("8675308");
cout << endl << "Reading cart contents: " << endl;
for (std::string item : newGirl.getCart()) {
std::cout << "Cart item " << item << std::endl;
}
cout << endl << "Store tests: " << endl << endl <<
amazon.getProductFromID("1002") << endl << endl <<
amazon.getMemberFromID("8675309");
cout << endl << "Customer rundown: " << endl <<
"Account ID: " << newGuy.getAccountID() << endl <<
"Premium membership status: " << newGuy.isPremiumMember() << endl;
cout << endl << "Product rundown: " << endl <<
"ID Code: " << jammies.getIdCode() << endl <<
"Title: " << jammies.getTitle() << endl <<
"Price: $" << jammies.getPrice() << endl <<
"Description: " << jammies.getDescription() << endl <<
"Quantity in stock: " << jammies.getQuantityAvailable() << endl;
cout << endl << "Decrementing quantity in stock..." << endl;
jammies.decreaseQuantity();
cout << "Current quantity in stock: " << jammies.getQuantityAvailable() << endl;
cout << endl << "Adding product to cart for newGuy..." << endl;
newGuy.addProductToCart(jammies.getIdCode());
cout << "Cart contents: Product ID " << newGuy.getCart().at(0) << endl;
cout << endl << "Emptying cart..." << endl << endl;
newGuy.emptyCart();
return 0;
}