Program is to define a class as employee, C/C++ Programming

Program is to define a class as employee:

Write a program to define a class as employee and collect information about them by using classes and object

class employee

  {

  private:

    char name[20];

    int empno;

    float basic,hra,da;

    float netpay;

    float calculate()

     {

     netpay=basic+hra+da;

      return netpay;

     }

  public:

     void readdata();

     void dispdata();

  };

 

void employee::readdata()

  {

  clrscr();

  cout<<" enter your name "<<"\n";

  gets(name);

  cout<<" enter the empoyee number "<<"\n";

  cin>>empno;

  cout<<" enter the basic salary "<<"\n";

  cin>>basic;

  cout<<" enter the house rent allowance "<<"\n";

  cin>>hra;

  cout<<" enter the dearance allowance"<<"\n";

  cin>>da;

   }

 

void employee::dispdata()

  {

  clrscr();

  cout<<" the name is :"<

  cout<<" the employee number is :"<

  calculate();

  cout<<" the salary you get is : "<

  }

 

 void main()

  {

  clrscr();

  employee info;

  info.readdata();

  info.dispdata();

  }

Posted Date: 10/19/2012 5:26:34 AM | Location : United States







Related Discussions:- Program is to define a class as employee, Assignment Help, Ask Question on Program is to define a class as employee, Get Answer, Expert's Help, Program is to define a class as employee Discussions

Write discussion on Program is to define a class as employee
Your posts are moderated
Related Questions
Virtual Functions The keyword virtual was previously used to resolve ambiguity for a class derived from two classes, both having a common ancestor. These classes are known as v

Multiple Inheritance Multiple inheritance , as the name suggests , is  deriving a class from more than one class . The derived class inherits all the properties of all its base c

Binary Options EA for DirectFX and SignalPush Project Description: I want a programmer who will build an EA based on my three types of Binary strategy's using two Indicators.

write c program to do the following : -fill 2 dimensional array (square matrix array with size=4). -ask the user to enter any integer number and add this number to the diagonals -o

C Program for DIVISER   void main() {           int result,number,min;           clrscr();           printf("ENTER THE NUMBER=");           flushall();

Step 1 Define the start of the program    It should be noted that within C all commands should end in a semi-colon. For most of your programs the definition of a program header as

Relationship between an Array and Pointers. Consider the following. int arr[] = {0,1,2,3,4,5,6,7,8,9}; If we write arr , it is considered as the address of the first elem


Explain Processing A Data File? Mainly data file applications needs that a data file be altered as it is being processed. For instance in an application involving the processin

Write a program that finds the minimum total number of shelv, C/C++ Programming