Need Help

ok so i did a program that will take the number of hours worked in a week annd the number of dependents ans inputs and then outputs the workers gross pay, each withholding amount, and the net take home pay per week.

The Program should come out as this:
Regular Hours :34
Overtime hours: 0
gross pay : $323.00
social tax: 19.38
federal tax: $45.22
Statte tax: $16.15
Number of dependents covered: 2
additional health insurance expence: $0

Net take home pay: $236.25


The employer pay rate is 9.50
the employer worked 34 hours "regular hours 40 or less"
if any hours are paid at over time rate of one and one half time that
from the gross pay, 6% of social is with held, 14% form federal income, 5% from state income, 6$ per week from union dues, and if worker has 3 or more covered dependent, then an additional 10$ is wothheld to cover the extra cost of health insurance

heres my program:

#include <iostream>
using namespace std;

int main ()
{
int regHours; // Regular Hours
float hourlyPay, gross, otime, socialtax, federaltax, statetax, uniondues, dep, health; // gross income, overtime, social tax, federal tax, state tax, union dues, depen covered, health insurance
double opay, sopay, fpay, spay, unpay, deppay, healthpay, netpay; // overtime scoial federal state union dependents and health withholdings including netpay

// Loop to do everything
{
cout << "Hello Employee" << endl;

cout << "Enter hours you have worked: ";
cin >> regHours;

cout << "Enter hourly pay rate: $";
cin >> hourlyPay;

cout << "Enter overtime rate: " ;
cin >> otime;

cout << "Enter percentage to be withheld for social security tax in decimal form: ";
cin >> socialtax;

cout << "Enter percentage to be withheld for federal income tax in decimal form: ";
cin >> federaltax;

cout << "Enter percentage to be withheld for state income tax in decimal form: ";
cin >> statetax;

cout << "Enter Union dues: ";
cin >> uniondues;

cout << "Enter number of dependents covered: ";
cin >> dep;

cout << "Enter additional health insurance expence: ";
cin >> health;


gross = regHours * hourlyPay; //Grosspay
{
gross += (regHours - 40) * otime * hourlyPay;
}
opay = regHours * 1.5; //Over time hours
sopay = gross * socialtax; //Social income tax withholdings
fpay = gross * federaltax; //Federal income tax withholdings
spay = gross * statetax; //State withholdings
unpay = gross - uniondues; //Union Dues
deppay = gross - healthpay; //Number of dependents covered
healthpay = gross - health; //Addition health insurance expence
if( deppay >= 3 )
{
healthpay = gross - 10;
}
netpay = gross - opay - sopay - fpay - spay - deppay - healthpay; //Netpay

cout << "Weekly Report: \n\n";
cout << "Regular Hours: " << regHours << endl;
cout << "Gross Pay: $" << gross << endl;
cout << "Social income tax: $" << sopay << endl;
cout << "Federal income tax: $" << fpay << endl;
cout << "Union dues: $" << unpay << endl;
cout << "Number of dependents covered: $" << deppay << endl;
cout << "Additional health insurace expence: $" << healthpay << endl;
cout << "Net take home pay: $" << netpay << endl;

}

system("pause");
return 0;

}

the program runs but theres still errors in it, it did not make some of the calculations right.

what formula do i use to calculate overtime hours if there was over time?
what formula do i use to take out union dues from total income?
How to I set the number of independents covered to match the health cost if it was 3 or more?

What are the errors?

also, please use code tags.
Last edited on
Topic archived. No new replies allowed.