A company pays its employees on a weekly basis. The company has three types of e
ID: 3850378 • Letter: A
Question
A company pays its employees on a weekly basis. The company has three types of employees:
• Salaried employees, who are paid a fixed weekly salary regardless of the number of hours worked;
• Hourly employees, who are paid by the hour and receive overtime pay;
• Commission based employees whose pay is based on a fixed weekly base pay of $500 plus 10% of the total sales for that week.
For example, a weekly sale of $10,000 would earn the employee a total of $1,500 ($500 base pay + $1,000 in commission) for that week.
Create a console-based object-oriented C++ application that
• Calculates weekly pay for an employee. The application should display text that requests the user input the name of the employee, type of employee, and the weekly salary, if it's a salaried employee, or hourly rate and hours worked in the week, if it’s an hourly employee.
• For hourly employees, the rate will be doubled if it’s beyond 40 hours/week.
• The program should then print out the name of the employees, employee status, total hours worked for the week, and hourly rate if applies, and the weekly payment amounts. In the printout, display the dollar symbol ($) to the left of the weekly pay amount and format the weekly payment amount to display currency. The program should print the list in certain order, for example, by employee type, then by wage, and then by total pay.
• Implements the following features that allows the user to: o Reward selected salaried employees by adding 10% to their salaries. Your program should display an asterisk (*) to the upper right of the weekly pay amount, and a note stating bonus added below the table, as shown below:
Name Status Hours Sales Wages Pay
James Hogan Salaried - - $75.00 $3,300.00*
Jennifer Waltz Hourly 45 - $10.95 $547.50
Molly Smith Hourly 32 - $15.00 $480.00
Bob Wagger Commissioned - $20,000 $500.00 $2,500.00
Joan Han Salaried - - $65.00 $2,860.00*
Submission • A design document (depicting the classes, and their relationships)
• Provide at least 5 test runs. Test runs should include at least each and every type of employee, and the report
Explanation / Answer
The code is given below :
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
int paycode,
TotalHours,
pieces;
double pay,
HourlySalary,
PieceWage,
WeeklySalary,
GrossWeeklySales;
cout << "Enter paycode "
<< "Enter 1 for Manager, 2 for Hourly Worker "
<< "3 for Commission Worker, and 4 for Piece Work. (0 to end): ";
cin >> paycode;
while (paycode < 0 || paycode >=5)
{
cout << "You must enter 0 through 4 ";
cout << "Enter 1 for Manager, 2 for Hourly Worker "
<< "3 for Commission Worker, and 4 for Piece Work. (0 to end): ";
cin >> paycode;
}
cout << fixed << showpoint << setprecision(2);
switch (paycode)
{
case 1:
cout << "Manager selected." << endl;
cout << "Enter weekly salary: ";
cin >> WeeklySalary;
cout << endl;
pay = WeeklySalary;
cout << "The manager's pay is $ " << pay;
cout << endl;
break;
case 2:
cout << "Hourly worker selected." << endl;
cout << "Enter the hourly salary: ";
cin >> HourlySalary;
cout << endl;
cout << "Enter the total hours worked: " << endl;
cin >> TotalHours;
if ( TotalHours <= 40)
pay = HourlySalary * TotalHours;
else
pay = (40.0 * HourlySalary) + (TotalHours - 40) * (HourlySalary * 1.5);
cout << endl;
cout << "Worker's pay is $ " << pay;
cout << endl;
break;
case 3:
cout << "Commission worker selected." << endl;
cout << "Enter gross weekly sales: ";
cin >> GrossWeeklySales;
cout << endl;
pay = (GrossWeeklySales *.57) + 250;
cout << "Commission worker's pay is $ " << pay << endl;
break;
case 4:
cout << "Pieceworker selected." << endl;
cout << "Enter number of pieces: ";
cin >> pieces;
cout << "Enter wage per piece: ";
cin >> PieceWage;
pay = pieces * PieceWage;
cout << "Pieceworker's pay is $ " << pay << endl;
break;
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.