PROGRAM USING A CLASS TO CALCULATE SIMPLE INTEREST AMOUNT.USE DEFAULT VALUEFOR RATE.

#include<iostream.h>
#include<conio.h>
Class INTEREST
{
      int n;
      float rate,p;
      public:
      void get()
     {
            cout<<”Enter the principle amount & no. of year:”;
            cin>>p>>n;
     }
     void cal(float r=3.2)
    {
            rate=r;
            float si;
            si=(p*n*rate)/100;
            cout<<”simple interest is:”<<si;
    }
};
void main()
{
       interest inst;
       clrscr();
       inst.get();
       inst.cal();
       getch();

}      

Comments

Popular Posts