题目描述

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.


输入格式

case 1: // pay code 1 corresponds to manager
cin >> salary;
//calculating and print
case 2: // pay code 2 corresponds to hourly worker
cin >> salary;
cin >> hours;
//calculating and print
case 3: // pay code 3 corresponds to commission worker
cin >> salary;
//calculating and print
case 4: // pay code 4 corresponds to pieceworker
cin >> pieces;
cin >> salary;
//calculating and print


输出格式

Note the spaces in the output.


样例数据

输入

1 10
2 10 5
3 10
4 10 5
-1

输出

Enter paycode (-1 to end): Manager selected.
Enter weekly salary: The manager's pay is $10.00

Enter paycode (-1 to end): Hourly worker selected.
Enter the hourly salary: Enter the total hours worked: Worker's pay is $50.00

Enter paycode (-1 to end): Commission worker selected.
Enter gross weekly sales: Commission worker's pay is $250.57

Enter paycode (-1 to end): Pieceworker selected.
Enter number of pieces: Enter wage per piece: Pieceworker's pay is $50.00

Enter paycode (-1 to end): 

备注


操作

评测记录

优秀代码

信息

时间限制: 1s
内存限制: 128MB
评测模式: Normal

题解