You are on page 1of 3

PROGRAM 8: To calculate bonus and salary hike of an

employee using classes.


#include<iostream.h>

#include<conio.h>

class employee

public:

char name[20];

char gender[10];

int age;

float sal,hike,bonus;

void salhike()

hike=0.12*sal;

cout<<"\nHike in salary : "<<hike;

void salbonus()

bonus=0.5*sal;

cout<<"\nSalary bonus : "<<bonus;

}e;

void main()

{
clrscr();

cout<<"\nEnter name : ";

cin>>e.name;

cout<<"\nEnter age :";

cin>>e.age;

cout<<"\nEnter gender : ";

cin>>e.gender;\

cout<<"\nSalary of employee : ";

cin>>e.sal;

cout<<"\nDetails of employee are :";

cout<<"\nName : "<<e.name;

cout<<"\nAge : "<<e.age;

cout<<"\nGender : "<<e.gender;

cout<<"\nSalary :"<<e.sal;

e.salhike();

e.salbonus();

getch();

You might also like