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

Assignment Help:

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();

  }


Related Discussions:- Program is to define a class as employee

Define classes and objects, Classes and Objects A class is a vehicle to...

Classes and Objects A class is a vehicle to execute the OOP features in the C++ language. Once a class is declared, an object of that type can be explained. An object is said t

Padovan string, write a program that counts the number of occurrences of th...

write a program that counts the number of occurrences of the string in the n-th padovan string p(n)   program 1 : package test.padovanstring; public class PadovanString {

Implement the c++ code in assembly language, Selecting Array Elements Imple...

Selecting Array Elements Implement the following C++ code in assembly language, using the block-structured .IF and .WHILE directives. Assume that all variables are 32-bit signed in

Program, write a class player that contains attributes for player name,avg ...

write a class player that contains attributes for player name,avg and team.write three functions to input,change and display these attributes.also write a constructor that asks for

When i develop a destructor, When I develop a destructor, do I require to e...

When I develop a destructor, do I require to explicitly call the destructors for my member objects?

Loops, Create a program that will accept 3 numbers. The first number (num1)...

Create a program that will accept 3 numbers. The first number (num1) is the common difference and the second number (num2) is the starting number and the 3rd number (num3) is the m

Area under the curve, Write a program to find the area under the curve y = ...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Implementing Dynamic Binding for RPC, i didnt no how to write and how to im...

i didnt no how to write and how to implement and the programming can be done in C and execution should be done in UNIX

C program for string operations, Aim: To implement a program for following...

Aim: To implement a program for following string operations: Length of String. String Concatenation. Substring (provide start index and length) Find character a

Change to palindrome, A palindrome is a string that reads the same from the...

A palindrome is a string that reads the same from the both the ends. Given a string S convert it to a palindrome by doing character replacement. Your takes is to convert S to palin

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd