-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbank2.cpp
More file actions
111 lines (102 loc) · 1.69 KB
/
bank2.cpp
File metadata and controls
111 lines (102 loc) · 1.69 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
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
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<algorithm>
#define DEBUG(x) cout<< '>' << #x<<':'<<x<<endl;
#define ll long long int
#define intd(x); scanf("%d",&x);
#define intf(x); scanf("%f",&x);
using namespace std;
class account
{
string cust_name;
int acc_no;
char type;
public:
account() {}
account(string name, int no, char t)
{
cust_name=name;
acc_no=no;
type=t;
}
};
class cur_acct:public account
{
float balance;
float minBalance;
float service;
public:
cur_acct(float b, float mn, float ser)
{
balance=b;
minBalance=mn;
service=ser;
}
void deposit(float bln)
{
balance+=bln;
}
void display() // display the balance
{
cout<<"Current Balance: "<<balance<<endl;
}
//void interest() // compute and deposit interest
//{}
void withdraw(float bln) // permit withdrawal and update balance
{
if(balance<minBalance) {
balance-=service;
}
balance-=bln;
if(balance<0) {
balance=0;
}
}
void check() // check
{}
};
class sav_acct:public account
{
float balance;
public:
sav_acct(float b)
{
balance=b;
}
void deposit(float bln)
{
balance+=bln;
}
void display() // display the balance
{
cout<<"Current Balance: "<<balance<<endl;
}
void interest(float r, int n, int t) // compute and deposit interest
{
balance=balance*pow((1+((r*1.0)/n)),(n*t));
}
void withdraw(float _balance) // permit withdrawal and update balance
{
if(balance<_balance) {
cout<<"NOT POSSIBLE\n";
} else {
balance-=_balance;
}
}
//void check() // check
//{}
};
int main()
{
cur_acct a(10,20,30);
a.deposit(200);
a.display();
a.withdraw(100);
a.display();
return 0;
}