-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathatm.h
112 lines (89 loc) · 2.6 KB
/
atm.h
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/* atm.h */
#include<iostream>
using namespace std;
int inBal=47000;
class authentication
{
private:
int pin;
public:
void authenticate();
};
class myATM
{
private:
int balance,deposit,withdraw,receipt;
public:
void atm_stuff();
void acc_balance();
void withdrawal();
void acc_deposit();
void options();
};
void myATM::acc_deposit()
{
int nxt_tran;
cout<<"BALANCE : Ksh"<<inBal<<endl;
cout<<"Enter the amount to deposit : ";cin>>deposit;
double finBal=inBal+deposit;
cout<<"Ammount accepted !"<<endl;
cout<<"CURRENT BALANCE : Ksh"<<finBal<<endl;
cout<<"Transaction complete !"<<endl;
cout<<"Do you want to make another transaction ?"<<endl;
cout<<"1: YES"<<endl;
cout<<"2: NO"<<endl;
cin>>nxt_tran;
if(nxt_tran==1){myATM opt; opt.options();}else{cout<<"Thank you, goodbye"<<endl;}
}
void myATM::acc_balance()
{
int nxt_tran;
balance=inBal;
cout<<"CURRENT BALANCE : Ksh"<<balance<<endl;
cout<<"Transaction complete !"<<endl;
cout<<"Do you want to make another transaction ?"<<endl;
cout<<"1: YES"<<endl;
cout<<"2: NO"<<endl;
cin>>nxt_tran;
if(nxt_tran==1){myATM opt; opt.options();}else{cout<<"Thank you, goodbye"<<endl;}
}
void myATM::withdrawal()
{
int nxt_tran;
double overdraft;
balance=inBal;
double withdraw=0;
cout<<"CURRENT BALANCE : Ksh"<<balance<<endl;
cout<<"Enter the ammount to withdraw : ";cin>>withdraw;
if(withdraw>balance){cout<<"Sorry, your account balance is insufficient to withdraw Ksh "<<withdraw
<<". Do you however want to make an overdraft ? (You will be owing the bank in this case)"<<endl;
cout<<"1: YES"<<endl; cout<<"2: NO"<<endl;
cin>>overdraft;
if(overdraft==1)
{
double over_draft=withdraw-balance;
cout<<"Transaction complete !"<<endl; cout<<"Withdrawn : Ksh"<<withdraw<<endl;
cout<<"CURRENT BALANCE : Ksh0.00"<<endl;
cout<<"OVERDRAFT : Ksh"<<over_draft<<endl;
}
else if(overdraft==2)
{
double withdraw_2=0;
cout<<"Enter the ammount to withdraw : ";cin>>withdraw_2;
double finBal_wth=balance-withdraw_2;
cout<<"Transaction complete !"<<endl; cout<<"Withdrawn : Ksh"<<withdraw_2<<endl;
cout<<"CURRENT BALANCE : Ksh"<<finBal_wth<<endl;
}
}
else
{
double finBal_wth=balance-withdraw;
cout<<"Transaction complete !"<<endl; cout<<"Withdrawn : Ksh"<<withdraw<<endl;
cout<<"CURRENT BALANCE : Kshs"<<finBal_wth<<endl;
}
cout<<"Do you want to make another transaction ?"<<endl;
cout<<"1: YES"<<endl;
cout<<"2: NO"<<endl;
cin>>nxt_tran;
if(nxt_tran==1){myATM opt; opt.options();}else{cout<<"Thank you, goodbye !"<<endl;}
}