#include<iostream.h>
#include<conio.h>
class interest
{
float p;
int n;
float r;
public:
void accept(float a,int b,float c=0.10)
{
p=a;
n=b;
r=c;
}
void display()
{
cout<<"\n\nP = "<<p<<" N = "<<n<<" R = "<<r;
}
float value();
};

float interest::value()
{
float A;
A=(p*n*r)/100;
return A;
}

int main()
{
interest i;
clrscr();
i.accept(5000.00,2,0.50);
i.display();
cout<<"\n\nThe Simple Interest Amount is : ";
cout<<i.value();
i.accept(5000.00,2);
i.display();
cout<<"\n\nThe Simple Interest Amount is : ";
cout<<i.value();
getch();

return 0;
}

Post a Comment

Previous Post Next Post