-
Notifications
You must be signed in to change notification settings - Fork 0
/
BillMain.cpp
81 lines (62 loc) · 2.53 KB
/
BillMain.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
81
// #include "DelegatingCompositebill.h"
// #include "CompositeBillPayer.h"
// #include "BillPayer.h"
// #include <random>
// #include <string.h>
// #include "Table.h"
// using namespace std;
// void composite1Test();
// void composite2Test();
// void composite3Test();
// int main(){
// srand(time(0));
// composite1Test();
// composite2Test();
// cout << endl;
// cout << "DONE" << endl;
// return 0;
// }
// void composite1Test(){
// vector<BillPayer*> leafBills1;
// vector<BillPayer*> leafBills2;
// srand(time(0));
// int customerNumber=0;
// for(; customerNumber<5; customerNumber++){
// float randomPrice = (rand() % 100 + 50)/2.0;
// string customerName = "Customer" + to_string(customerNumber);
// BillPayer* tempBill = new BillPayer(randomPrice, customerName);
// leafBills1.push_back(tempBill);
// }
// for(; customerNumber<11; customerNumber++){
// float randomPrice = (rand() % 100 + 100)/2.0;
// string customerName = "Customer" + to_string(customerNumber);
// BillPayer* tempBill = new BillPayer(randomPrice, customerName);
// leafBills2.push_back(tempBill);
// }
// CompositeBillPayer* compositeBill1 = new CompositeBillPayer(leafBills1[0]->getPayerName(), leafBills1);
// CompositeBillPayer* compositeBill2 = new CompositeBillPayer(leafBills2[0]->getPayerName(), leafBills2);
// DelegatingCompositeBill* delegatingBill = new DelegatingCompositeBill();
// delegatingBill->addBill(compositeBill1);
// delegatingBill->addBill(compositeBill2);
// delegatingBill->addBill(new BillPayer(50.4,"Andrew"));
// cout << "=======================Printing Bill=============================" << endl;
// cout << delegatingBill->getBillReceipt() << endl;
// delete delegatingBill;
// }
// void composite2Test(){
// BillComponent* bill = new DelegatingCompositeBill({new DelegatingCompositeBill({new BillPayer(99.9,"Jackson")})});
// cout << bill->getBillReceipt();
// BillComponent* bill2 = new BillPayer(50.4, "Jason");
// cout << bill2->getBillReceipt();
// BillComponent* bill3 = new DelegatingCompositeBill({bill,bill2});
// cout << bill3->getBillReceipt();
// }
// void composite2Test(){
// Table* t = new Table();
// t->addCust(new Customer("John"));
// t->addCust(new Customer("Jill"));
// t->addCust(new Customer("Jacob"));
// t->addCust(new Customer("Cena"));
// BillComponent* bill = t->generateBill();
// cout << bill->getBillReceipt();
// }