randomposts
Powered by Blogger.

Take Employee information like, Emp_Id, Emp_Name, Emp_design,Emp_Salary with the help of the function and display with appropriate function Programing code in c++

No comments

#include<iostream.h>___(Don't Missing Syntax required).
#include<conio.h>
#include<stdio.h>
#include<string.h>

class employe
{
     int empno;
     char name[20];
     char *desig;
     float empsal,emphra,empda,empta,emppf,empgsal;

     public:
           employe(int no,char na[],char *des,float sal,float hra,float da,float ta,float pf)
           {
                empno=no;
                strcpy(name,na);
                desig=des;
                empsal=sal;
                emphra=hra;
                empda=da;
                empta=ta;
                emppf=pf;
                empgsal=0;
           }
                employe(employe &s)
                {     empno=s.empno;
                     strcpy(name,s.name);
                     desig=s.desig;
                     empsal=s.empsal;
                     emphra=s.emphra;
                     empda=s.empda;
                     empta=s.empta;
                     emppf=s.emppf;
                     empgsal=s.empgsal;
                }

                void putdata()
                {
                     float hra=0;
                     hra=empsal*emphra/100;

                     float da=0;
                     da=empsal*empda/100;

                     float ta=0;
                     ta=empsal*empta/100;

                     float pf=0;
                     pf=empsal*emppf/100;

                     empgsal=empsal+hra+da+ta-pf;
                     cout<<"..............Employe Info............."<<endl;
                     cout<<"\n Employe Number :"<<empno<<endl;
                     cout<<"\n Employe Name: "<<name<<endl;
                     cout<<"\n Employe Designation :"<<desig<<endl;
                     cout<<"\n Employe Basic Salary: "<<empsal<<endl;
                     cout<<"\n HRA :"<<hra<<endl;
                     cout<<"\n DA  :"<<da<<endl;
                     cout<<"\n TA  :"<<ta<<endl;
                     cout<<"\n Pf  :"<<pf<<endl;
                     cout<<"\n Employe Net Salary :"<<empgsal<<endl;
                     cout<<"\n.......................................\n\n";
                }
};

void main()
{
     float no,salary,hra,da,ta,pf;
     char nam[20],*desig;

     clrscr();

     cout<<"\nEnter Employe Number:";
     cin>>no;

     cout<<"\nEnter Employe Name :";
     cin>>nam;

     cout<<"\nEnter Employe Designation :";
     cin>>desig;

     cout<<"\nEnter Empoye Basic Salary :";
     cin>>salary;

     cout<<"\nEnter HRA in % :";
     cin>>hra;

     cout<<"\nEnter DA in % :";
     cin>>da;

     cout<<"\nEnter TA in % :";
     cin>>ta;

     cout<<"\nEnter PF in % :";
     cin>>pf;

     employe s1(no,nam,desig,salary,hra,da,ta,pf);
     employe s2(s1);

     s1.putdata();
     s2.putdata();

     getch();
}


Note: *Remove The Sentence on this program ___(Don't Missing Syntax required).

No comments :

Post a Comment