Has to be done in c include files include include include i
Has to be done in c++.
// include files
#include
#include
#include
#include
using namespace std;
// declare constants here
const double FICA = 4.75;
const double OVERTIME = 1.5;
const double REG_HRS = 40.0;
const double MAX_DEPENDENTS = 2;
const double COST_PER_ADD = 12.00;
// function prototypes go here
void get_input(infile);
double calc_gross(double, double);
void print_paystub (double, double, double, double, double, double, double);
int main()
{
// declare variables
int ssn;
double payrate;
double fwh_percentage;
int dependents;
double hours_worked;
double gross_pay;
double net_pay;
double deduction_total;
double fwh_amount;
double insurance_amount;
double fica_amount;
// declare files
ifstream infile;
ofstream outfile;
// open files
infile.open(\"paystub_input.txt\");
outfile.open(\"paystub_output.txt\");
// call get_input
while(!infile.eof())
{
// call calc_gross
// call calc_deducts
// net_pay = gross_pay - deduction_total
// call print_paystub
// call get_input
}
// close files
system(\"pause\");
return 0;
}
/*************************************************
function get input
parameters: (All parameters passed by reference)
ssn, payrate, fwh_percentage,
dependents, hours_worked, infile
**************************************************/
void get_input()
{
// input in order ssn, payrate, fwh_percentage,
// dependents, hours_worked
}
/**************************************************
function: calc_gross
parameters: (value)
payrate
hours_worked
***************************************************/
double calc_gross(double payrate, double hours_worked)
{
double overtime_hours;
double regular_hours;
double gross;
// if the number of hours worked is over REG_HRS
// overtime_hours = hours_worked - REG_HRS
// regular_hours = REG_HRS;
// gross = (regular_hours * payrate) + (overtime_hours * OVERTIME)
// else
// gross = (hours_worked * payrate)
// return the gross to the calling function
}
/**********************************************************
function: calc_deducts
parameters:(value parameters)
fwh_percentage
dependents
gross_pay
(reference parameters)
fwh_amount
insurance_amount
fica_amount
deduction_total
***********************************************************/
void calc_deducts()
{
// calculate the fwh_amount by multiplying the gross pay by (fwh_percentage divided by 100)
// if dependents > MAX_DEPENDENTS
// insurance_amount is (dependents - MAX_DEPENDENTS) * COST_PER_ADD
// else
// insurance_amount is zero
// fica_amount is gross_pay times FICA times .01
// deduction_total is all deductions added together
}
/*******************************************************
fuction: print_paystub
parameters: (value)
ssn
hours_worked
gross_pay
fwh_amount
insurance_amount
fica_amount
net_pay
(reference)
outfile
********************************************************/
void print_paystub()
{
// output statements for the paystub
}
Solution
#include<iostream.h>
#include<conio.h>
#define SIZE 5
class emp
{
float basic,da,it,netsal;
char name[20],num[10];
public:
void getdata();
void net_sal();
void dispdata();
};
void emp::getdata()
{
cout<<\"\ Enter employee number: \" ;
cin>>name;
cout<<\" Enter employee name: \" ;
cin>>num;
cout<<\"Enter employee basic salary in Rs: \" ;
cin>>basic;
}
void emp::net_sal()
{
da=((0.52)*basic );
float gsal=da+basic;
it=((0.3)*gsal);
netsal=gsal-it;
}
void emp::dispdata()
{
cout
<<\"\ Employee number: \"<<name
<<\"\ Employee name: \"<<num
<<\"\ Employee netsalary: \"<<netsal<<\" Rs.\";
}
void main()
{
clrscr();
emp ob[SIZE];
int n;
cout<<\"\ \ ***********************************\"
<<\"\ Calculation of Employee Net Salary\"
<<\"\ ***********************************\"
<<\"\ Enter the number of employees\";
cin>>n;
for(int i=0;i<n;i++)
{
ob[i].getdata();
ob[i].net_sal();
}
clrscr();
cout<<\"\ -----------------\"
<<\"\ Employee Detail::\"
<<\"\ -----------------\";
for( i=0;i<n;i++)
{
cout<<\"\ \ Employee:\"<<i+1
<<\"\ ----------\";
ob[i].dispdata();
}
getch();
}




