Question

In: Computer Science

C++ Task: Compute the weekly pay for each employee at the Wahoo Widget Company. For each...

C++

Task: Compute the weekly pay for each employee at the Wahoo Widget Company. For each employee, you will calculate the base pay according to the appropriate salary category, and then subtract taxes and deductions. Write the program in C++ only.

Input: For each employee, read an employee ID (a 4-digit integer) and a salary category code (see below). Then read whatever other information might be needed to compute a net salary for that person. Because of occasional employee turn-over, you do not know the exact number of employees in advance. Determine how you will know when all employees have been processed for this week. (You will use a loop to process the employees, but not a counting loop.)

Processing: The Company has established 4 salary categories:

Code 1: Managers. They receive a fixed annual salary of $50,000.

Code 2: Factory workers. They receive a fixed wage of $14.85 per hour for the first 40 hours worked each week, then they receive time-and-a-half (1.5 the regular salary) for any overtime.

Code 3: Sales staff. They receive $250 each week, plus a commission that is 5.7% of their gross weekly sales of widgets.

Code 4: Pieceworkers. The part-time staff receives a fixed fee of $11.30 for each widget they produce. They do not pay health insurance or union dues.

Code 5: Owner, that’s me. I get $350,00.

Additional factors that apply to the employees:

The combined federal, state, and local taxes are computed as 19% of the gross salary.

After taxes are subtracted, $27.85 is deducted from the owner, managers, factory workers, and sales staff to cover health insurance and union dues.

Within the processing loop, use a switch statement to compute each employee’s weekly pay based on that employee’s pay code. Within the switch, prompt the user (i.e., the payroll clerk) to enter the appropriate facts that your program needs to calculate the gross salary for that pay code. Then subtract the taxes and deductions. The final result is the net salary (take-home pay).

Output: After each employee is processed, display the results on the screen: the employee ID, gross salary, taxes, deductions, and net salary. Format all money to two decimal places. Line up the decimal points in the display.

Solutions

Expert Solution


// C++ code
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;

struct employee

{


int ID;

char employeeCategory;

float finalSalary;

float regularDeduction;

float grossalary;

}e[5];

int main()

{

struct employee e[5];

float employeeSalary, taxrate = 0.19, sales;

int i,widgets,overtime;


for(i=0;i<5;i++)

{

cout << "Please enter employee ID: ";

cin >>e[i].ID;

cout << "Please enter employee's salary employeeCategory code: ";

cin >>e[i].employeeCategory;

char S = e[i].employeeCategory;


switch(S)

{

case '1':

employeeSalary = 50000;
e[i].regularDeduction = 27.85;

e[i].grossalary = employeeSalary;

e[i].finalSalary = (e[i].grossalary - e[i].grossalary * 0.19 - e[i].regularDeduction);

break;

case '2':

cout << "Please enter the overtime working hour for Factory Worker: ";
cin >> overtime;

e[i].grossalary = 14.85 * 40 + 14.85*1.5*overtime;

e[i].regularDeduction = 27.85;

e[i].finalSalary = e[i].grossalary - e[i].grossalary *0.19 -e[i].regularDeduction;

break;

case '3':

cin.ignore();
cout << "Please enter weekly sales of widgets: ";

cin >> sales;

e[i].grossalary = 250 + sales * 0.057;

e[i].regularDeduction = 27.85;

e[i].finalSalary = e[i].grossalary - e[i].grossalary*0.19 -e[i].regularDeduction;

break;

case '4':

cout << "Enter the number of widgets produce by Pieceworkers: ";
cin >> widgets;

e[i].regularDeduction = 27.85;

e[i].grossalary = 11.30 * widgets;

e[i].finalSalary = e[i].grossalary - e[i].grossalary *0.19;

break;

case '5':
employeeSalary = 35000;
e[i].regularDeduction = 27.85;
e[i].finalSalary = (e[i].grossalary - e[i].grossalary * 0.19 - e[i].regularDeduction);

break;

}

}


cout <<"==========weekly pay for each employee at the Wahoo Widget Company are following=========="<<endl;

cout << setw(20) << left <<"Employee ID" << setw(20)<<left<<"gross salary$"<< setw(20)<<left<<"taxes%"<<setw(20)<<left<<"regularDeduction$"<<setw(20)<<left<<"net salary$"<<endl;

for(i=0;i<5;i++)

{

cout << setw(20) << left <<e[i].ID << setw(20)<<left<<e[i].grossalary<< setw(20)<<left<<taxrate<<setw(20)<<left<<e[i].regularDeduction<<setw(20)<<left<<e[i].finalSalary<<endl;

}

return 0;

}


Related Solutions

Compute the deductions, net pay, and accumulated gross earnings for each weekly pay period. Assume that...
Compute the deductions, net pay, and accumulated gross earnings for each weekly pay period. Assume that Joseph is single and that $28.25 was withheld for medical insurance (pre-tax) and $20 for his United Way contribution. Use the wage bracket method to determine federal income tax. Round answers to the nearest hundredth. Gross Earnings(650.95) Allow.(1) Fed. Inc. Tax Social Security (6.2%)Medicare (1.45%) Medical Insurance Pre-tax United Way Total Deductions Net Pay Accum. Gross Earnings ($1,558.90)
Requirements: Compute the OASDI for each employee. Compute the HI for each employee. On the Employer...
Requirements: Compute the OASDI for each employee. Compute the HI for each employee. On the Employer Register, compute the employer FICA liability. Payroll Register Complete the steps below: Compute the OASDI for each employee. Compute the HI for each employee. Compute the totals for each tax. Note: Round your final answers to the nearest cent. KIPLEY COMPANY, INC. Employee Payroll Register For Period Ending January 8, 20-- EARNINGS DEDUCTIONS NET PAY Name Gross OASDI HI   FIT     SIT     SUTA     CIT   SIMPLE...
You are asked to compute weekly payment for an employee working at CubixLabs. The CubixLabs has...
You are asked to compute weekly payment for an employee working at CubixLabs. The CubixLabs has a policy such that, if the employee works less than 50 hours in a week then he/she will get payment as per the given payment rate, that is amount per hour. Otherwise (in all other conditions) he/she will get payment which is 50 x payment rate. Develop program using C language
Bonus Homework for Week 5 Preparing a Weekly Payroll Report Employee Name Gross Weekly Pay State...
Bonus Homework for Week 5 Preparing a Weekly Payroll Report Employee Name Gross Weekly Pay State Withholding Tax Federal Withholding Tax Net Pay Sue Smith $800 ________________ ________________ Tom Brown $300 ________________ ________________ Mary Wilson $250 ________________ ________________ James Jackson $100 ________________ ________________ John Sinatra $600 ________________ ________________ Betty Rockford $1,255 ________________ ________________ Similar assignment as our in-class IF function work - you must calculate the amount of State Withholding Tax and Federal Withholding Tax. Also calculate Net Pay. Watch-out...
Design and implement an application that can compute the weekly pay for different students at a college.
In Java Design and implement an application that can compute the weekly pay for different students at a college. Students (all with a name, major, GPA) can be undergraduate or graduate students. Undergraduate students can be volunteers to be tuto rs or teaching assistants. Graduate students can be teaching assistants or research assistants. Volunteer tuto rs are not paid anything. Undergraduate teaching assistants are paid $15 per hour and can work a maximum of 20 hours per week. Graduate teaching assistants...
Write a program in C to process weekly employee timecards for all employees of an organization...
Write a program in C to process weekly employee timecards for all employees of an organization (ask the user number of employees in the start of the program). Each employee will have three data items: an identification number, the hourly wage rate, and the number of hours worked during a given week.A tax amount of 3.625% of gross salary will be deducted. The program output should show the identification number and net pay. Display the total payroll and the average...
If Sven Company pays employees each Wednesday for the weekly pay period ending the previous Friday,...
If Sven Company pays employees each Wednesday for the weekly pay period ending the previous Friday, and an entry is made each Friday to accrue the payroll for that week, the journal entry to record on payday (Wednesday) would involve a debit to: Question 8 options: a) Wage Expense. b) Wages Payable. c) Cash. d) Cash Expense. e) None of these. On August 1, supplies were purchased. Supplies were debited and Accounts Payable credited for $2,500. $700 of these supplies...
a widget manufacturing company makes big widgets and small widgets. Each widget must processed in a...
a widget manufacturing company makes big widgets and small widgets. Each widget must processed in a wood shop and in a paint shop. It takes 480 minutes of process time per work day per shop. If the paint shop paints only small widgets, then 60 can be painted per day. If the paint shop paints large widgets only then 40 can be painted per day. If the wood shop only process large widgets only then it could process 50 widgets...
Write a program to process weekly employee time cards for all employees of an organization. Each...
Write a program to process weekly employee time cards for all employees of an organization. Each employee will have three data items: an identification number, the hourly wage rate, and the number of hours worked during a given week. Each employee is to be paid time and a half for all hours worked over 40. A tax amount of 3.625% of gross salary will be deducted. The program output should show the employee’s number and net pay. Display the total...
For each of the following employees, calculate the Social Security tax for the weekly pay period...
For each of the following employees, calculate the Social Security tax for the weekly pay period described: NOTE: For simplicity, all calculations throughout this exercise, both intermediate and final, should be rounded to two decimal places at each calculation. 1: Ronald McCarthy earned gross pay of $925. Each period he makes a 401(k) contribution of 6% of gross pay. His current year taxable earnings for Social Security tax, to date, are $29,500. Total Social Security tax = $ 2: Jill...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT