-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatmApplication.cpp
76 lines (66 loc) · 1.65 KB
/
atmApplication.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
#include <iostream>
using namespace std;
void options()
{
cout << "*******Choose an Option*******" << endl;
cout << "1. Check Balance" << endl;
cout << "2. Deposit" << endl;
cout << "3. Withdraw" << endl;
cout << "4. Exit" << endl;
cout << "*******************" << endl
<< endl;
cout << "Option: ";
}
int main()
{
int input;
double depositAmt, withdrawAmt;
double balance = 100;
string name;
cout << "Welcome to your ATM account" << endl;
cout << "Please enter your name: ";
cin >> name;
cout << "Hello " << name << "!" << endl;
while (input != 4)
{
options();
cin >> input;
system("cls");
switch (input)
{
case 1:
cout << "Dear " << name << " your balance is " << balance << "ETB" << endl;
break;
case 2:
cout << "Enter the amount you want to deposit: ";
cin >> depositAmt;
balance += depositAmt;
cout << "Success!" << endl;
break;
case 3:
cout << "Enter the amount you want to withdraw: ";
cin >> withdrawAmt;
if (withdrawAmt <= balance)
{
balance -= withdrawAmt;
cout << "Success!" << endl;
}
else
{
cout << "Insufficient funds!" << endl;
}
break;
default:
if (input == 4)
{
break;
}
else
{
cout << "Invalid Option!" << endl;
break;
}
}
}
return 0;
}