Code for the salary computation
#include <iostream>
using namespace std;
int main()
{
cout << " SAMPLE PROGRAM FOR SALARY " << endl;
int hours, dependents;
float grosspay, netpay;
float socialsec, federal, state, unionfee, health;
cout << "Number of hours worked : ";
cin >> hours;
cout << "Number of dependents : ";
cin >> dependents;
const float HOURLYPAY = 16.75;
if (hours > 40)
{
grosspay = HOURLYPAY * 40 + 1.5 * (hours-40);
} else {
grosspay = HOURLYPAY * hours;
}
socialsec = grosspay * 0.06;
federal = grosspay * 0.14;
state = grosspay * 0.05;
unionfee = 10;
if (dependents >= 3)
{
health = 35;
} else {
health = 0.0;
}
netpay = grosspay -
(socialsec + federal + state + unionfee + health);
cout << "\n\nGrosspay : " << grosspay << endl;
cout << "- Social Security : " << socialsec << endl;
cout << "- Federal Tax : " << federal << endl;
cout << "- State Tax : " << state << endl;
cout << "- Union dues : " << unionfee << endl;
cout << "- Health Insurance : " << health << endl;
cout << "---------------------" << endl;
cout << "Net Pay : " << netpay << endl;
system("PAUSE");
return 0;
}