Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int hours_worked, number_dependents;
- double rate_pay = 16.78, ss_tax = 0.06, fed_tax = 0.14, st_tax = 0.05, un_due = 10.00, ext_h = 35.00;
- double gross_pay, net_pay, ss_withheld, fed_withheld, st_withheld;
- cout << "This program calculates net pay using hours worked and rate per hour\n";
- << "while crediting overtime pay of a rate and a half\n";
- << "minus a 6% Social Security Tax, 14% Federal Income Tax, 5% State Tax,\n";
- << "$10 of union dues, and withholds an additional $35 insurance fee\n";
- << "if employee has 3 or more dependents.\n";
- << "Please enter the number of weekly hours worked:\n";
- cin >> hours_worked;
- cout << "Please enter the number of dependents:\n";
- cin >> number_dependents;
- if (hours_worked>40)
- {
- gross_pay = rate_pay*40 + 1.5*rate_pay*(hours_worked-40);
- }
- else
- {
- gross_pay = rate_pay*hours_worked;
- }
- cout.setf(ios::fixed);
- cout.setf(ios::showpoint);
- cout.precision(2);
- {
- ss_withheld=gross_pay*ss_tax;
- fed_withheld =gross_pay*fed_tax;
- st_withheld=gross_pay*st_tax;
- if (number_dependents>= 3)
- {
- net_pay=gross_pay-ss_withheld-fed_withheld-st_withheld-un_due-ext_h;
- }
- else
- net_pay=gross_pay-ss_withheld-fed_withheld-st_withheld-un_due;
- }
- cout << "Hours the employee worked for the week:" << hours_worked << endl;
- << "Employee rate of pay per hour: $" << rate_pay << endl;
- << "Number of dependents:" << number_dependents << endl;
- << "The gross pay for the employee is: $" << gross_pay << endl;
- << "Social security tax withheld is: $" << ss_withheld << endl;
- << "Federal income tax withheld is: $" << fed_withheld << endl;
- << "State tax withheld is: $" << st_withheld << endl;
- << "Weekly union due is $10.00\n";
- << "The net pay for the employee is: $" << net_pay << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement