-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoop_tut06.cpp
55 lines (46 loc) · 954 Bytes
/
oop_tut06.cpp
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
#include <iostream>
using namespace std;
// constructor
class bankdeposit
{
int invest;
int period;
int investrate;
double returnvalue;
public:
bankdeposit() {}
bankdeposit(int, int, int);
void display();
int calculation(int);
};
bankdeposit ::bankdeposit(int i, int p, int r)
{
invest = i;
period = p;
investrate = r;
returnvalue = invest;
}
int bankdeposit::calculation(int p,int returnvalue)
{
for (int i = 0; i <p; i++)
{
returnvalue = returnvalue + (i * r);
}
}
void bankdeposit::display()
{
cout << "Enter amount you want to be deposit : ";
cin >> invest;
cout << "how long you want to store amount in bank : ";
cin >> period;
cout << "Enter the investrate : ";
cin >> investrate;
cout << "your amount after " << period << " is " <<calculation ;
}
int main()
{
bankdeposit ali;
ali.display();
ali.calculation();
return 0;
}