Lab 3
Part I: Name your program payroll.cpp
A company pays its employees different wages based on their type of position. Managers receive a fixed weekly salary equal to 1/52 of their yearly salary. Hourly workers receive a fixed hourly wage up to 40 hours of work and 1.5 their hourly wage for each hour above 40 that they work. Commission workers receive $250 plus 5.7% of their gross weekly earnings. Pieceworkers produce only one type of item during a pay period and are paid a fixed amount for each item produced.
Write a program to compute the weekly pay of each employee. Initially, enter the number of employees to process. Each worker has a pay code (1=manager; 2=hourly; 3=commission;4=pieceworker). For each worker, enter the pay code and prompt for the additional information needed to do the calculation of the weekly pay.
Input will be:
A positive integer representing the number of employees to process.
For each employee,
pay code
Use a switch on pay code to ask for input and do the calculation:for 1, input yearly salary
for 2, input hourly wage, hours worked for week
for 3, gross weekly earningsfor 4, number of items produced, amount per item
All employees will pay 7.5% of their weekly pay in taxes.
Output (besides the prompts) will be the weekly pay for each employee
Compile and test your program. Note a for loop is a good choice for the outer loop.
Part II.
Compile the program in preparation for using the debugger. Set two breakpoints. Run the program to completion and
then clear the breakpoints. When a break occurs, experiment with some of the gdb commands. To demonstrate that
you did this, start a script before you enter the debugger.