#include<iostream.h>
#include<conio.h>
#include<string.h>
class FDA
{
long int amt;
int fno;
char name[22];
float interest_rate;
float mat_amt;
int no_of_months;
public:
      FDA(){}
      FDA(int f,char *s,int a,int n,float r=0.15);
      void display()
      {
cout<<"\n\nFix deposit number : "<<fno;
cout<<"\n\nCustomer name : "<<name;
cout<<"\n\nPrinciple amount : "<<amt;
cout<<"\n\nInterest rate : "<<interest_rate;
cout<<"\n\nNo_of_months : "<<no_of_months;
cout<<"\n\nMaturity amount : "<<mat_amt;
      }
};
FDA::FDA(int f,char *s,int a,int n,float r)
{
fno=f;
strcpy(name,s);
amt=a;
no_of_months=n;
interest_rate=r;
mat_amt=0;
for(int i=1;i<n;i++)
mat_amt=mat_amt+(amt*interest_rate);
}
int main()
{
FDA FD;
long int x;
int f,nom,a;
char n[20];
float r;
clrscr();
cout<<"\n\nEnter Fix deposit number : ";
cin>>f;
cout<<"\n\nEnter Customer name : ";
cin>>n;
cout<<"\n\nEnter Amount : ";
cin>>a;
cout<<"\n\nEnter Number of months : ";
cin>>nom;
FD=FDA(f,n,a,nom);
FD.display();
getch();
return(0);
}

Post a Comment

Previous Post Next Post