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
C Program for FUNCTION OF COPY ONE STRING IN OTHER STRING #include stdio.h> #include conio.h> int copy(char a[],char b[]); void main() {           char a[100],b[

Operator overloading - c++ program: Write a program in c to define operator overloading. class matrix{                   private :                 int x[2][2];

write a program that declares and initializes 2 integer variable a and b with the value 35 and 14, and displays and calculates their sum,product,quotient and real division result.t

Define the Float Data Type of c Language? The float is used to define floating point numbers. The Floating point numbers are stored in 32 bits with 6 digits of precision. Eg

1. De ne a function chomp :: String -> String that selects a run of repeated characters from the start of a string with the run being as long as possible. For example ch

Does improper inheritance have a potential to wreck a project? Many projects meet a dead end due to bad inheritance. Hence it certainly has potential to wreck a project. Sma

Write a program to determine V c for a given value of time (t)   #include stdio.h #include math.h void main() {      char prompt;   float vs,cr,t,vc;   /* input time */

THEORY OF COMPUTER PROGRAMMING

Project Description: I would like to be building regarding a complex mobile application build as we require the signing of an NDA. My firm in based in Montreal Canada and we are

what is the purpose of pointer ? what is the syntax? how it works?