-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
69 lines (58 loc) · 1.66 KB
/
Copy pathmain.cpp
File metadata and controls
69 lines (58 loc) · 1.66 KB
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
#include "global.h"
int main() {
double valueInput; // Saves any number from user to pass into methods
string stringInput; // Saves any string to pass into methods
char choice; // To save the choice from user in menu
Budget userBudget;
int choosenID;
cout << "Enter Your salary: ";
cin >> valueInput;
userBudget.modifySalary(valueInput);
do {
cout << endl;
cout << "-Budget Tracker-" << endl;
cout << "1. Add Expense" << endl;
cout << "2. Add Income" << endl;
cout << "3. Display Summary" << endl;
cout << "4. Remove Last Expense/Income" << endl;
cout << "5. Modify An Income/Expense By ID" << endl;
cout << "6. Exit" << endl;
cout << "Enter Your Choice: ";
cin >> choice;
switch (choice)
{
case '1':
cout << "Enter Expense category: ";
cin >> stringInput;
cout << "Enter Expense amount: ";
cin >> valueInput;
userBudget.addExpInc(valueInput, stringInput, false); // false for expenses
break;
case '2':
cout << "Enter Income category: ";
cin >> stringInput;
cout << "Enter Income amount: ";
cin >> valueInput;
userBudget.addExpInc(valueInput, stringInput, true); // true for incomes
break;
case '4':
userBudget.removeExpense();
break;
case '5':
cout << "Enter ID of Income/Expense to modify: ";
cin >> choosenID;
userBudget.modifyExpInc(choosenID);
break;
case '6': // if user choose 6 to exit then print summary before exit
// no break to print the summary
case '3':
userBudget.summary();
break;
default: // If user enter something not from (1-6)
cout << "Wrong input, Try again :)" << endl;
break;
}
cout << endl;
} while (choice != '6');
userBudget.~Budget();
}