Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/*Task : Compute the weekly pay for each employee at the Wahoo Widget Company. For each employee, you will calculate the base pay according to

/*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, thats 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 employees weekly pay based on that employees 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.

*/

// THIS MY CODE BUT NOOOOO OUTPUTTTTTTTTTTT

#include

#include

#include

#include

using namespace std;

int main()

{

const int numOfEmloyees = 5;

char ch;

int category = numOfEmloyees;

int id, hour, widget;

double grossSalary, deduction, finalSalary, tax, salaryFor40, overTime, sale, commission;

cout << " Please enter your id (a four digit integer) " << endl;

cin >> id;

cout << " Please enter your salary category code " << endl;

cin >> category;

switch (category)

{

case '1' :

grossSalary = 50000;

tax = 0.19 * grossSalary;

deduction = 27.85;

finalSalary = grossSalary - tax - deduction;

cout << " Your Net salary is " << finalSalary << endl ;

break;

case '2' :

grossSalary = 14.85;

cin >> hour;

if(hour > 40)

{

salaryFor40 = grossSalary * 40;

overTime = 1.5 * grossSalary * (hour - 40);

grossSalary = salaryFor40 + overTime;

}

else

{

grossSalary = grossSalary * hour;

}

tax = 0.19 * grossSalary;

deduction = 27.85;

finalSalary = grossSalary - tax - deduction;

cout << " Your Net salary is " << finalSalary << endl ;

break;

case '3' :

grossSalary = 250;

int week;

cout << " Please enter the number of week you worked " << endl;

grossSalary = grossSalary * week;

cout << " Please enter the amount of sale of widget " << endl;

cin >> sale;

commission = 0.057 * sale;

grossSalary += commission;

tax = 0.19 * grossSalary;

deduction = 27.85;

finalSalary = grossSalary - tax - deduction;

cout << " Your Net salary is " << finalSalary << endl ;

break;

case '4' :

cout << " No of widgets produced " << endl;

cin >> widget;

grossSalary = 11.30 * widget;

tax = 0.19 * grossSalary;

deduction = 0;

finalSalary = grossSalary - tax - deduction;

cout << " Your Net salary is " << finalSalary << endl ;

break;

case '5' :

grossSalary = 350000;

tax = 0.19 * grossSalary;

deduction = 27.85;

finalSalary = grossSalary - tax - deduction;

cout << " Your Net salary is " << finalSalary << endl ;

break;

default:

cout << " Invalid salary code " << endl;

break;

while(ch == 'Y' )

{

cout << " Please enter Y to continue or N to quit " << endl;

cin >> ch;

}

}

//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 << setw(20) << left << " net salary$ " << " " << endl;

for(int i; i < 5; i++)

{

double grossSalary, deduction, tax, finalSalary;

cout << setw(20) << left << id << setw(20) << left << grossSalary << setw(20) << left << tax <<

setw(20) << left << deduction << setw(20) << left << finalSalary << endl;

}

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

More Books

Students also viewed these Databases questions