-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patht1.cpp
More file actions
78 lines (56 loc) · 1.08 KB
/
Copy patht1.cpp
File metadata and controls
78 lines (56 loc) · 1.08 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
/*
deposite of amount in bank
*/
#include<iostream>
using namespace std;
class bankdeposite{
int principal;
int years;
float interestrate;
float returnvalue;
public:
bankdeposite(){}
bankdeposite(int p,int y,float r);
bankdeposite(int p,int y,int r);
void show();
};
bankdeposite::bankdeposite(int p,int y,float r)
{
principal=p;
years=y;
interestrate=r;
returnvalue=principal;
for(int i=0;i<y;i++)
{
returnvalue=returnvalue*(1+interestrate);
}
}
bankdeposite::bankdeposite(int p,int y,int r)
{
principal=p;
years=y;
interestrate=float(r)/100;
returnvalue=principal;
for(int i=0;i<y;i++)
{
returnvalue=returnvalue*(1+interestrate);
}
}
void bankdeposite::show(){
cout<<"principal amount was"<<principal<<endl<<"return value after"<<years<<"is"<<returnvalue<<endl;
}
int main()
{
bankdeposite b1,b2,b3;
int p,y;
float r;
int R;
cout<<"enter the value of p,y,r";
cin>>p>>y>>r;
b1=bankdeposite(p,y,r);
b1.show();
cout<<"ente rthe value p,y,R"<<endl;
cin>>p>>y>>R;
b2=bankdeposite(p,y,R);
b2.show();
}