C++ Programming
Assignment Objectives: The objectives of Week 1 assignment is: Implement multiple selection using the control statements ( i. e switch selection statement) Work with functions in C++ and to use the logical operators Assignment Purpose: To write a program that demonstrates the concepts of the control statements that we learned this week. Assignment Description: Problem Description: A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and “time-and-a-half”—1.5 times their hourly wage—for overtime hours worked), commission workers (who receive $250 plus 5.7 percent of their gross weekly sales), or pieceworkers (who receive a fixed amount of money per item for each of the items they produce—each pieceworker in this company works on only one type of item). Write a program to compute the weekly pay for each employee. You do not know the number of employees in advance. Each type of employee has its own pay code: Managers have code 1, hourly workers have code 2, commission workers have code 3 and pieceworkers have code 4. Use a switch to compute each employee’s pay according to that employee’s paycode. Within the switch, prompt the user (i.e., the payroll clerk) to enter the appropriate facts your program needs to calculate each employee’s pay according to that employee’s paycode.
Complete Program:
Sample Output:
CODE TO COPY:
// Header files section
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
// function prototype
void printSummary(int managers, int hourlyWorkers, int
commissionWorkers, int pieceWorkers);
// start main function
int main()
{
// declare the required variables
int paycode;
double weeklySales;
double hourlyWage;
double hoursWorked;
double amountPerPiece;
int piecesProduced;
double totalPay;
int managers = 0;
int hourlyWorkers = 0;
int commissionWorkers = 0;
int pieceWorkers = 0;
cout << fixed <<
setprecision(2);
// prompt the user to enter the paycode
cout << "Enter paycode (-1 to end):
";
cin >> paycode;
while (paycode != -1)
{
switch (paycode)
{
case 1: // managers have code 1
managers++;
cout << "Manager selected." << endl;
cout << "Enter fixed weekly salary: ";
cin >> totalPay;
cout << "Manager's pay is $" << totalPay <<
endl;
break;
case 2: // hourly workers have code 2
hourlyWorkers++;
cout << "Hourly worker selected." << endl;
cout << "Enter hourly salary: ";
cin >> hourlyWage;
cout << "Enter total hours worked: ";
cin >> hoursWorked;
if (hoursWorked <= 40)
{
totalPay = hoursWorked * hourlyWage;
}
else
{
totalPay = 40 * hourlyWage + (hoursWorked - 40) * 1.5 *
hourlyWage;
}
cout << "Worker's pay is $" << totalPay <<
endl;
break;
case 3: // commission workers have code
3
commissionWorkers++;
cout << "Commission worker selected." << endl;
cout << "Enter gross weekly sales: ";
cin >> weeklySales;
totalPay = 250.0 + weeklySales * (5.7 / 100);
cout << "Commission worker's pay is $" << totalPay
<< endl;
break;
case 4: // piece workers have code 4
pieceWorkers++;
cout << "Piece worker selected." << endl;
cout << "Enter amount of money per item: ";
cin >> amountPerPiece;
cout << "Enter number of items produced: ";
cin >> piecesProduced;
totalPay = amountPerPiece * piecesProduced;
cout << "Piece Worker's pay is $" << totalPay <<
endl;
break;
default:
cout << "Invalid paycode." << endl;
}
cout << endl
<< "Enter paycode (-1 to end): ";
cin >>
paycode;
}
// call the printSummary function
printSummary(managers, hourlyWorkers,
commissionWorkers, pieceWorkers);
return 0;
} // end of main function
// printSummary function implementation
void printSummary(int managers, int hourlyWorkers, int
commissionWorkers, int pieceWorkers)
{
cout << endl << "Summary of Payouts"
<< endl;
cout << left << setw(19) <<
"Employee Categories" << " " << right << setw(11)
<< "Number Paid" << endl;
cout << "------------------- -----------"
<< endl;
cout << left << setw(19) <<
"Managers" << " " << right << setw(11) <<
managers << endl;
cout << left << setw(19) <<
"Hourly Workers" << " " << right << setw(11)
<< hourlyWorkers << endl;
cout << left << setw(19) <<
"Commission Workers" << " " << right << setw(11)
<< commissionWorkers << endl;
cout << left << setw(19) <<
"Piece Workers" << " " << right << setw(11)
<< pieceWorkers << endl;
} // end of printSummary function
C++ Programming Assignment Objectives: The objectives of Week 1 assignment is: Implement multiple selection using the...
A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and “time-and-a-half,” i.e. 1.5 times their hourly wage, for overtime hours worked), commission workers (who receive $250 plus 5.7% of their gross weekly sales), or pieceworkers (who receive a fixed amount of money per item for each of the items they produce-each pieceworker in this company works on only one...
Problem 3. Given the following business scenario, create a Crow’s Foot ERD using a specialization hierarchy if appropriate. Granite Sales Company keeps information on employees and the departments that they work in. For each department, the department name, internal mail box number, and office phone extension are kept. A department can have many assigned employees, and each employee is assigned to only one department. Employees can be salaried employees, hourly employees, or contract employees. All employees are assigned an employee number. This...
Write a Java application with a class name of Payroll, for the “Travel Agency”, that willCalculate the weekly paycheck for both Salaried and Hourly employees. Salaried employees will be paid 1/52 of their annual pay minus 18% withheld for federal and state taxes, as well as 4% for retirement pension. Salaried employees do not collect overtime pay. There are two types of Hourly employees; permanent employees and temporary weekly employees. •Permanent weekly employees will be paid their hourly rate minus...
Granite Sales Company keeps information on employees and the departments that they work in. For each department, the department name, internal mail box number, and office phone extension are kept. A department can have many assigned employees, and each employee is assigned to only one department. Employees can be salaried employees, hourly employees, or contract employees. All employees are assigned an employee number. This is kept along with the employee’s name and address. For hourly employees, hourly wage and target...
Given the following business scenario, create a Crow’s Foot ERD using a specialization hierarchy if appropriate. Granite Sales Company keeps information on employeesand the department that they work in. For each department, the department name, internal mail box number, and office phone extension are kept. A department can havemany assigned employees, and each employee is assigned to only one department. Employees can salaried employees, hourly employees, or contract employees. All employeesare assigned an employee number. This is kept along with...
RUN THIS PROGRAM ON NETBEANS As a Software Developer, you have received a requirement from a Company to implement a prototype for its payroll system. You receive the following specifications: If an employee works more than its regular hours, it is considered overtime and it will be paid based on the employee’s experience. All employees are paid biweekly (80 hours) Employee taxes: 1% This company manages three categories of workers based on employee’s experience. Group 1 (Silver) o Pay rate:...
Visual C# C# Visual Studio 2017 You are to create a class object called “Employee” which included eight private variables - firstN - lastN - idNum -wage: holds how much the person makes per hour -weekHrsWkd: holds how many total hours the person worked each week. - regHrsAmt: initialize to a fixed amount of 40 using constructor. - regPay - otPay After going over the regular hours, the employee gets 1.5x the wage for each additional hour worked. Methods: -...
I am having a hard time with my program to assignment 4.12. Here are the instructions: The Payroll Department keeps a list of employee information for each pay period in a text file. The format of each line of the file is the following: <last name> <hours worked> <hourly wage> Write a program that inputs a filename from the user and prints to the terminal a report of the wages paid to the employees for the given period. The report...
// Enter your name as a comment for program identification // Program assignment testEmployeeAB.cpp // Enter your class section, and time /* The program testEmployeeAB.cpp tests the class Employee. The class Date is included so that the Employee class can use the Date data type. */ /* Data is entered to create an employee data file. */ /* A payroll report and equal employment opportunity report showing ethnicity data is displayed. */ //header files /* use the correct preprocessor directives...
Assignment Four (T) Compatiblity Mode 4 Weekly Payroll. Wnite a Java program to create a weekly payroll using the following Adrated Weekly Income Income Tax Withheld $0 to $124 Over $124 to $399 Over $899 to $1,85 Over $1,855 to 53,064 Over $3,084 to $3,439 Over $5,439 Tax Guide. Your program should request the following information employee id number (integer), hourly wage, hours worked per week, number of with holding exemptions, manital status (use a code 0 and 1 or...