"The best way to cheer yourself up is to try to cheer somebody else up." Mark Twain

Friday, January 22, 2010

Consider the following structure :

struct info {
float hra_rate, da_rate, cca, pf_rate, it_rate;
int days_worked;
};

struct emp
{
int empno;
char name[21];
float basic;
info others;
} salemp, puremp, imemp;

Using the information stored in others member of emp, calculate the Gross and Net Salary of an employee. The Gross Salary is calculated as follows :

(basic x days _ worked) /26  + (basic x hra _ rate)/100 + (basic x da _rate)/100 +cca

The Net Salary is calculated as follows :

Gross_Salary – ((basic x it _rate) /100 + (basic x pt _rate )/100)

==================================================================

#include<iostream.h>
#include<conio.h>
#include <stdio.h>

struct info {
float hra_rate, da_rate, cca, pf_rate, it_rate;
int days_worked;
};


struct emp
{
int empno;
char name[21];
float basic;
info others;
} salemp, puremp, imemp;




void main()
{
float gs, ns;
cout<< “\n Enter Records for Sale Emp :”;
cout <<”\n Enter EmpNo, EmpName, Basic Pay, HRA-rate, DA-rate, CCA-rate, PF-rate, IT-rate, Days of Work :”;
cin >> salemp.empno;
gets(salemp.name);
cin>> salemp.basic>> salemp.others.hra_rate >> salemp.others.da_rate >> salemp.others.cca >> salemp.others.pf_rate >> salemp.others.it_rate;
gs = (salemp.basic x salemp.others.days _ worked) /26  + (salemp.basic x salemp.others.hra _ rate)/100 + (salemp.basic x salemp.others.da _rate)/100 + salemp.others.cca;
ns = gs – ((salemp.basic x salemp.others.it_rate)/100 +( salemp. basic x salemp.others.pt_rate) /100);

cout<< “\nEmpNo.\tName\tThe Gross salary (Rs.)\t The Net Salary (Rs).”;

cout<<”\n”<< salemp.empno << “\t” << salemp.name<<”\t”<
<<”\t”< < gs < < ns;
cout<<”\n*******************************************”;




cout<< “\n Enter Records for Purchase Emp :”;
cout <<”\n Enter EmpNo, EmpName, Basic Pay, HRA-rate, DA-rate, CCA-rate, PF-rate, IT-rate, Days of Work :”;
cin >> puremp.empno;
gets(puremp.name);
cin>> puremp.basic>> puremp.others.hra_rate >> puremp.others.da_rate >> puremp.others.cca >> puremp.others.pf_rate >> puremp.others.it_rate;


gs = (puremp.basic x puremp.others.days _ worked) /26  + (puremp.basic x puremp.others. hra _ rate)/100 + (puremp.basic x puremp.others.da _rate)/100 + puremp.others.cca;


ns = gs – ((puremp.basic x puremp.others.it_rate)/100 +( puremp.basic x puremp.others.pt_rate) /100);
cout<< “\nEmpNo.\tName\tThe Gross salary (Rs.)\t The Net Salary (Rs).”;
cout<<”\n”<< salemp.empno << “\t” << salemp.name<<”\t”<
<<”\t”< < gs < < ns ;
cout<<”\n*****************************************”;
getch();

No comments:

Post a Comment

C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.
Now Playing: Ballade Pour Adeline

About Me

My photo
I m an IT lecturer of a college. I love social-work. I want to do something beneficial for society before dying , that can promote our society, to some extent.