-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
70 lines (64 loc) · 1.74 KB
/
main.c
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
#include <stdio.h>
#include "myBank.h"
int main() {
enum Action {
OPEN_ACCOUNT = 'O',
BALANCE_INQUIRY = 'B',
DEPOSIT = 'D',
WITHDRAWAL = 'W',
CLOSE_ACCOUNT = 'C',
INTEREST = 'I',
PRINT = 'P',
EXIT = 'E',
NONE = 0
};
char action = NONE;
printf("\nPlease choose a transaction type:\n O-Open Account\n B-Balance Inquiry\n D-Deposit\n W-Withdrawal\n C-Close Account\n I-Interest\n P-Print\n E-Exit\n");
while(action != EXIT) {
scanf(" %c", &action);
switch (action) {
case OPEN_ACCOUNT: {
openAccount();
break;
}
case BALANCE_INQUIRY: {
accountBalance();
break;
}
case DEPOSIT: {
deposit();
break;
}
case WITHDRAWAL: {
withdrawal();
break;
}
case CLOSE_ACCOUNT: {
closeAccount();
break;
}
case INTEREST: {
interestRate();
break;
}
case PRINT: {
printAccounts();
break;
}
case NONE: {
break;
}
case EXIT: {
closeAllAccounts();
break;
}
default: {
printf("Invalid transaction type\n");
break;
}
}
if (action != EXIT) {
printf("\nPlease choose a transaction type:\n O-Open Account\n B-Balance Inquiry\n D-Deposit\n W-Withdrawal\n C-Close Account\n I-Interest\n P-Print\n E-Exit\n");
}
}
}