-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
executable file
·80 lines (70 loc) · 1.76 KB
/
main.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
72
73
74
75
76
77
78
79
80
#include "ItemToPurchase.h"
#include "ShoppingCart.h"
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;
int main() {
string userName;
string dateToday;
string nameItem;
string descriptionItem;
double priceItem;
int quantityItem;
string optionSelect;
cout << "Enter Customer's Name: ";
getline(cin, userName);
cout << "Enter Today's Date: ";
getline(cin, dateToday);
ShoppingCart shoppingCart(userName, dateToday);
cout << endl;
cout << "Enter option: ";
cin >> optionSelect;
cin.ignore();
do {
if (optionSelect == "add") {
cout << "Enter the item name: ";
getline(cin, nameItem);
cout << "Enter the item description: ";
getline(cin, descriptionItem);
cout << "Enter the item price: ";
cin >> priceItem;
cin.ignore();
cout << "Enter the item quantity: ";
cin >> quantityItem;
cin.ignore();
shoppingCart.AddItem(ItemToPurchase(nameItem, descriptionItem, priceItem, quantityItem));
}
else if (optionSelect == "remove") {
cout << "Enter name of the item to remove: ";
getline(cin, nameItem);
shoppingCart.RemoveItem(nameItem);
}
else if (optionSelect == "change") {
cout << "Enter the item name: ";
getline(cin, nameItem);
cout << "Enter the new quantity: ";
cin >> quantityItem;
cin.ignore();
shoppingCart.ChangeQuantity(nameItem, quantityItem);
}
else if (optionSelect == "descriptions") {
shoppingCart.ShowDescriptions();
}
else if (optionSelect == "cart") {
shoppingCart.ShowCart();
}
else if (optionSelect == "options") {
shoppingCart.ShowOptions();
}
else {
shoppingCart.ShowOptions();
}
cout << "Enter option: ";
cin >> optionSelect;
cin.ignore();
} while (optionSelect != "quit");
cout << "Goodbye.";
return 0;
}