-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCODE23.cpp
More file actions
47 lines (43 loc) · 1.04 KB
/
CODE23.cpp
File metadata and controls
47 lines (43 loc) · 1.04 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
#include <iostream> //SIMPLE interest CALLULATOR USING CONSTRUCTOR AND FUNCTION
using namespace std;
class SimpleI
{
int money, years; //DATA MEMBERS
float get, Interset, Return, km;
public:
SimpleI(int, int, int); //CONSTRUCTOR PROTOTYPE
void getdata(); //FUNCTION PROTOTYPE
};
SimpleI::SimpleI(int Ma, int Ic, int YY) //CONSTRUCTOR
{
money = Ma;
Interset = float(Ic) / 100;
years = YY;
for (size_t i = 0; i < YY; i++)
{
km = (1 + Interset);
Return = money * km;
}
}
void SimpleI::getdata()
{
for (int i = 0; i < years; i++)
{
static float ii = Return;
cout << i << ". year your money " << ii << endl;
ii = ii * km;
}
}
int main()
{
int r, i, y;
cout << "enter money: : " << endl;
cin >> r;
cout << "expected interest : : " << endl;
cin >> i;
cout << "expected years : : " << endl;
cin >> y;
SimpleI a1(r, i, y);
a1.getdata();
return 0;
}