This is a sample C++ Program to calculate net salary. Calculate net salary on the basis of basic salary (HRA & DA).
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
class Emp
{
char na[10];
int code, basic;
public:
void read()
{
cout<<"Enter Name, Code & Basic Salary:";
gets (na);
cin>>code>>basic;
}
float cal()
{
float net;
float da,hra;
hra=basic*0.5;
da=basic*0.4;
net=basic+hra+da;
return(net);
}
void print()
{
cout<<'\n'<<"Details Of Employee:"<<'\n';
cout<<"********************"<<'\n';
cout<<"Code: "<<code<<'\n';
cout<<"Name:"<<na<<'\n';
cout<<"Net Salary: "<<cal();
}
};
void main()
{
clrscr();
Emp E;
E.read();
E.print();
getch();
}
OUTPUT:
Enter Name, Code & Basic Salary:
Lena John
15242
25000
Details Of Employee:
********************
Code: 15242
Name: Lena John
Net Salary: 47500
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com