-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMainModule.cpp
More file actions
51 lines (45 loc) · 814 Bytes
/
MainModule.cpp
File metadata and controls
51 lines (45 loc) · 814 Bytes
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
#include "MainModule.h"
MainModule::MainModule(Inventory* db) : MenuModule(db)
{
c = new RingUp(db, 0.08);
i = new InventoryModule(db);
r = new Report(db);
}
MainModule::~MainModule()
{
delete c;
delete i;
delete r;
}
void MainModule::PrintMenu()
{
cout << "\n1. Cashier Module";
cout << "\n2. Inventory Database Module";
cout << "\n3. Report Module";
cout << "\n4. Quit\n";
}
void MainModule::ProcessUserInput()
{
string userInput;
getline(cin, userInput);
if (userInput.length() > 1)
throw "Invalid input";
switch (userInput[0])
{
case '1':
c->Run();
break;
case '2':
i->Run();
break;
case '3':
r->Run();
break;
case '4':
is_terminated = true;
break;
default:
throw "Invalid input";
break;
}
}