Question

Design an algorithm to calculate the weekly pay for employees. The user will prompted to enter...

Design an algorithm to calculate the weekly pay for employees. The user will prompted to enter the number of hours worked and their job code. Hours in excess of 40 are paid at 1.5 times the hourly pay. Job code hourly rates are: P - $10, Q - $12.50, R - $15.00, and S - $20.00. Use both a case and a selection structure.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

weekly_pay()

{

//taking the inputs

input hours_worked;

input job_code;

//using switch case to determine hourly rate

switch(job_code)

{

case 'P':

hourly_rate=10;

break;

case 'Q':

hourly_rate=12.5;

break;

case 'R:

hourly_rate=15;

break;

case 'S':

hourly_rate=20;

break;

}

//checking hours worked to calculate weekly pay

if(hours_worked>40)

{

weekly_pay=40*hourly_rate+(hours_worked-40)*hourly_rate*1.5;

}

else

{

weekly_pay=hours_worked*hourly_rate;

}

return weekly_pay; //returning result

}

Add a comment
Know the answer?
Add Answer to:
Design an algorithm to calculate the weekly pay for employees. The user will prompted to enter...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Problem : Overtime Pay: Federal law requires that hourly employees be paid “time-and-a-half” for work in...

    Problem : Overtime Pay: Federal law requires that hourly employees be paid “time-and-a-half” for work in excess of 40 hours a week. For example, if a person’s hourly wage is $15 and he or she works 60 hours in a week, the person’s grow pay should be (40 * 15) + 1.5 * 15 * (60 – 40)) = $1050 Enter the hourly wage: 12.50 Enter the number of hours worked: 47 The gross pay for the week is $631.25

  • A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who...

    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...

  • 1.) Write a code in Python to Calculate weekly pay with overtime for an hourly employee...

    1.) Write a code in Python to Calculate weekly pay with overtime for an hourly employee (if number of hours exceed 40, then the hourly rate goes up by 50% of the usual hourly rate; the user will provide the hourly rate and the number of hours worked)

  • COMPUTING OVERTIME RATE OF PAY AND GROSS WEEKLY PAY Mike Fritz receives a regular salary of...

    COMPUTING OVERTIME RATE OF PAY AND GROSS WEEKLY PAY Mike Fritz receives a regular salary of $3,250 a month and is paid 1½ times the regular hourly rate for hours worked in excess of 40 week. per (a) Calculate Fritz's overtime rate of pay. (Compute to the nearest half cent.) (b) Calculate Fritz's total gross weekly pay if he works 46 hours during the week.

  • Calculate Payroll K. Mello Company has three employees-a consultant, a computer programmer, and an administrator. The fo...

    Calculate Payroll K. Mello Company has three employees-a consultant, a computer programmer, and an administrator. The following payroll information is available for each employee: Consultant Computer Programmer Administrator Regular earnings rate $2,710 per week $34 per hour $50 per hour Overtime earnings rate Not applicable 2 times hourly rate 1.5 times hourly rate Federal income tax withheld $910 $252 $500 For hourly employees, overtime is paid for hours worked in excess of 40 hours per week. For the current pay...

  • Calculate Payroll K. Mello Company has three employees-a consultant, a computer programmer, and an administrator. The...

    Calculate Payroll K. Mello Company has three employees-a consultant, a computer programmer, and an administrator. The following payroll information is available for each employee: Consultant Computer Programmer Administrator Regular earnings rate $36 per hour $3,010 per week Not applicable $48 per hour 1.5 times hourly rate Overtime earnings rate 2 times hourly rate Federal income tax withheld $930 $246 $505 For hourly employees, overtime is paid for hours worked in excess of 40 hours per week. For the current pay...

  • Calculate Payroll K. Mello Company has three employees-a consultant, a computer programmer, and an administrator. The...

    Calculate Payroll K. Mello Company has three employees-a consultant, a computer programmer, and an administrator. The following payroll information is available for each employee: Consultant Computer Programmer Administrator Regular earnings rate $3,010 per week $36 per hour $50 per hour Overtime earnings rate Not applicable 2 times hourly rate 1.5 times hourly rate Federal income tax withheld $910 $258 $515 For hourly employees, overtime is paid for hours worked in excess of 40 hours per week. For the current pay...

  • Calculate Payroll K. Mello Company has three employees-a consultant, a computer programmer, and an administrator. The...

    Calculate Payroll K. Mello Company has three employees-a consultant, a computer programmer, and an administrator. The following payroll information is available for each employee: Consultant Computer Programmer Administrator Regular earnings rate $2,710 per week $50 per hour $30 per hour 2 times hourly rate Not applicable 1.5 times hourly rate Overtime earnings rate Federal income tax withheld $925 $239 $500 For hourly employees, overtime is paid for hours worked in excess of 40 hours per week. For the current pay...

  • Calculate Payroll K. Mello Company has three employees-a consultant, a computer programmer, and an administrator. The...

    Calculate Payroll K. Mello Company has three employees-a consultant, a computer programmer, and an administrator. The following payroll information is available for each employee: Consultant Computer Programmer Administrator Regular earnings rate $2,010 per week $30 per hour $42 per hour Overtime earnings rate Not applicable 2 times hourly rate 1.5 times hourly rate Federal income tax withheld $910 $251 $495 For hourly employees, overtime is paid for hours worked in excess of 40 hours per week. For the current pay...

  • Develop a WPF application that has a button to calculate an employee’s weekly pay, given the...

    Develop a WPF application that has a button to calculate an employee’s weekly pay, given the number of hours worked. An employee should have a first name, last name, age, and hourly consulting rate. You should be able to create an employee object and provide the hours worked to calculate the weekly pay. The application assumes a standard workweek of 40 hours. Any hours worked over 40 hours in a week are considered overtime and earn time and a half....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT