Powered by Blogger.

Tuesday, February 5, 2013

calculating the interest

/* Q.N 4. Write a program to create that calculates the interest of any number */
#include<stdio.h>
#include<conio.h>
#include<iostream.h>

class interest
{
      int year;
      float rate,amount;
      public:
             void getval();
             void calcint();
             };
            
      void interest::getval()
      {
           cout<<"Enter Principal Amount : "<<endl;
           cin>>amount;
           cout<<"\nEnter Rate and Time in Year : "<<endl;
           cin>>rate>>year;
           }
          
      void interest::calcint()
      {
           float inter=(amount*year*rate/100);
           cout<<"\nThe Interest Amount : "<<inter<<endl;
           }
          
      int main()
      {
          interest I;
          I.getval();
          I.calcint();
          getch();
          return 0;
          }
            

0 comments:

Post a Comment