Share
Explore BrainMass

Write a Program to Calculate Weekly Pay

A company pay its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the 40 hours they work and "time-and-a-half"- 1.5 times their hourly wage- for overtime hours workers), commission workers (who receive $250 plus 5.7% of their gross weekly sales), or pieceworkers (who received 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 that commutes the weekly pay for each employee. Each type of employee has its own pay code: Managers have has pay code 1, hourly workers have code 2, commission workers have code 3 and pieceworkers have code 4. I also have to use a switch to compute each employee's pay according to that employee's pay code. Within the switch, prompt the user (i.e. the payroll clerk) to enter the appropriate facts the program needs to calculate each employee's pay according to that employee's pay code.

Solution Preview

To write such a program that commutes the weekly pay for each employee, we need to first make the program asks the user for an employee pay code, then we use a switch statement to determine which function to use to calculate the wages for the employee. The program then need to ask the user to enter the facts needed to calculate each employee's pay.

To do this we need to first establish the constants and variables the program will need.

Following is an algorithm for such a program.

"Constant" and "Real" are data types needed ...

Solution Summary

This solution provides guidelines on how to write a program that allows one to determine the pay for different types of employees (managers, hourly workers, commission workers, or pieceworkers).

$2.19