Note – Subject to Change
Open project template to start
Complete the following
Structures for project
struct Employee {
string firstname;
string lastname;
int hours;
int regHours;
int otHours;
double regRate;
double otRate;
double regPay;
double otPay;
double totPay;
double ficaTax;
double SSMedTax;
double totDecutions;
double netPay;
}; //Structure arrays
Employee employees[MAX_EMPLOYEES];
Write a program that will calculate the payroll for 3 employees. It will also total the payroll for the company.
Write functions that will do the following
displayMenu – displays the follows
•Press 1 to input employees
•Press 2 to input hours
•Press 3 to calculate payroll
•Press 4 to calculate totals – Extra Credit
•Press 5 to print payroll
•Press X to exit
getSelection – gets menu selection and validates input with a switch statement. Use a do while until get valid input. If not valid does the following
•Displays error message
•Calls displayMenu
•Gets new input selection
processSelection – extra credit to process
inputEmployee that will input the information for 3 employees. Use a for loop
•User input
string firstname;
string lastname;
int empNum;
double regular rate
double ot rate (calculated)
inputHours that will get the total hours worked for each employee.
Note Overtime hours will be calculated in the calcPayroll function for hours worked over MAX_REG_HOURS
initializeEmployees sets all fields to “” or 0
calcPayroll – Calculates the payroll by using reg hours worked and overtime hours worked. Overtime hours worked is any hours > MAX_REG_HOURS and is done for you
•Calculated fields
otHours – calculated as hours over the maxreghours. If regHours = 48 then OT hours would be 8
regPay (regHours * regRate)
otPay (otHours * otRate)
totalPay (regPay + otPay)
fica (total pay * fica pct)
socSec (total pay * ss med pct)
totDeductions (fica + socSec)
netPay (totalPay – totDeductions)
displayPayroll Displays all fields for each employee on a separate line. Format all money to 2 decimal places. Function will also print the payroll totals and averages