-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path15_oops.cpp
More file actions
57 lines (51 loc) · 1.08 KB
/
15_oops.cpp
File metadata and controls
57 lines (51 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
#include<iostream>
using namespace std;
class BankDeposit{
int principal;
int years;
float intrestrate;
float 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)
{
principal=p;
years=y;
intrestrate=r;
returnvalue = principal;
for(int i=0;i<y;i++){
returnvalue = returnvalue *(1+ intrestrate);
}
}
BankDeposit::BankDeposit( int p, int y,int R)
{
principal=p;
years=y;
intrestrate=float(R)/100;
returnvalue = principal;
for(int i=0;i<y;i++){
returnvalue = returnvalue *(1+ intrestrate);
}
}
void BankDeposit:: show(){
cout<<endl<<"Principal ammount was"<<" "<<principal<<" "<<"Return value after"<<" "<<years<<" "<<"is"<<" "<<returnvalue<<" "<<endl;
}
int main(){
BankDeposit d1,d2,d3;
int p,y;
float r;
int R;
cout<<"enter the value of p y and r"<<endl;
cin>>p>>y>>r;
d1=BankDeposit(p,y,r);
d1.show();
cout<<"enter the value of p y and R"<<endl;
cin>>p>>y>>R;
d2=BankDeposit(p,y,R);
d2.show();
return 0;
}