-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankDeposit.cpp
More file actions
65 lines (61 loc) · 1.33 KB
/
BankDeposit.cpp
File metadata and controls
65 lines (61 loc) · 1.33 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
#include<iostream>
using namespace std;
class bankdeposit
{
int principle,year;
float interestrate,returnvalue;
public:
bankdeposit(){}
bankdeposit(int p,int y,float r);
bankdeposit(int p,int y,int r);
void show();
};
bankdeposit::bankdeposit(int p,int y,float r)
{
principle=p;
year=y;
interestrate=r;
returnvalue=principle;
for (int i = 0; i <y; i++)
{
returnvalue=returnvalue*(1+interestrate);
}
}
bankdeposit::bankdeposit(int p,int y,int r)
{
principle=p;
year=y;
interestrate=float(r)/100;
returnvalue=principle;
for (int i = 0; i <y; i++)
{
returnvalue=returnvalue*(1+interestrate);
}
}
void bankdeposit:: show()
{
cout<<endl<<"Principle ammount was:"<<principle<<" Return value after:"<<year<<" year"<<" Is "<<returnvalue<<endl;
}
int main()
{
bankdeposit bd1,bd2,bd3;
int p,y,R;
float r;
cout<<"Enter your principle ammount: ";
cin>>p;
cout<<"Enter Years: ";
cin>>y;
cout<<"Enter Rate: ";
cin>>r;
bd1=bankdeposit(p,y,r);
bd1.show();
cout<<endl<<"Enter your principle ammount: ";
cin>>p;
cout<<"Enter Years: ";
cin>>y;
cout<<"Enter Rate: ";
cin>>R;
bd2=bankdeposit(p,y,R);
bd2.show();
return 0;
}