PROGRAM ON DEFINING A CLASS WORKER.

#include<iostream.h>
#include<conio.h>
Class WORKER
{
      int wno;
      char wname[20];
      float hrwrk,wgrate;
      float totwage;
     void calwg()
     {
           totwage=hrwrk,wgrate;
           cout<<totwage;
     }
     public:
     void TAKEDATA()
     {
            cout<<”Enter the worker no.:”;
            cin>>wno;
            cout<<”Enter the name of worker:”;
            gets(wname);
            cout<<”Enter the hours worked by worker:”;
            cin>>hrwrk;
            cout<<”Enter the wagerate of worker:”;
            cin>>wgrate;
            CALWG();
       }
        void SHOWDATA()
       {
             cout<<”Worker no. is:”<<wno;
             cout<<”Worker name is:”<<wname;
             cout<<”Hours :”<<hrwrk;
             cout<<”wagerate:”<<wgrate;
       }
};
void main()
{
       clrscr();
       worker w;
       w.takedata();
       w.showdata();
       getch();
}
       

   

Comments

Popular Posts