Question

Acme Parts runs a small factory and employs workers who are paid one of three hourly...

Acme Parts runs a small factory and employs workers who are paid one of three hourly rates depending on their shift: first shift, $17 per hour; second shift, $18.50 per hour; third shift, $22 per hour. Each factory worker might work any number of hours per week; any hours greater than 40 are paid at one and one-half times the usual rate. In addition, second- and third-shift workers can elect to participate in the retirement plan for which 3% of the worker’s gross pay is deducted from the paychecks.

Write a program that prompts the user for hours worked, shift, and, if the shift is 2 or 3, whether the worker elects the retirement (1 for yes, 2 for no). Display:

  1. Hours worked
  2. Shift
  3. Hourly pay rate
  4. Regular pay
  5. Overtime pay
  6. Total of regular and overtime pay
  7. Retirement deduction, if any
  8. Net pay.

import java.util.*;
public class AcmePay {
public static void main(String[] args) throws Exception {
// Write your code here
}
}

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

package HomeworkLibmarch19;

import java.util.Scanner;

public class AcmePay {
   public static void main(String[] args) throws Exception {
   // Write your code here
       Scanner sc=new Scanner(System.in);
       System.out.println("Enter hours worked: ");
       int hrs=sc.nextInt();
       System.out.println("Enter the shift which you worked in: ");
       int shft=sc.nextInt();
       int replan=0;
       if(shft!=1){
           System.out.println("Do you want to participate in retirement plan(1 for yes 2 for no): ");
           replan=sc.nextInt();
       }
       System.out.println("Hours worked: "+hrs);
       double hpayrate=0;
       if(shft==1){
           hpayrate=17;
       }
       else if(shft==2){
           hpayrate=18.50;
       }
       else{
           hpayrate=22;
       }
       System.out.println("Hourly pay rate: $"+hpayrate);
       double overpay=0;
       double regpay=0;
       if(hrs>40){
           regpay=(hpayrate*40);
       }
       else{
           regpay=(hpayrate*hrs);
       }
       System.out.println("Regular pay: $"+regpay);
       int overtime=0;
       if(hrs>40){
           overtime=hrs-40;
       }
       overpay=overtime*(1.5*hpayrate);
       System.out.println("Overtime pay: $"+overpay);
       System.out.println("Total of regular and overtime pay: $"+(regpay+overpay));
       double retdeduc=0;
       if(replan==1){
           retdeduc=(regpay+overpay)*0.03;
       }
       double totpay=regpay+overpay;
       System.out.println("Retirement deduction: $"+retdeduc);
       System.out.println("Net pay: $"+(totpay-retdeduc));

   }
}

Expected output:

Enter hours worked: 42 Enter the shift which you worked in: 2 Do you want to participate in retirement plan (1 for yes 2 for

Enter hours worked: 30 Enter the shift which you worked in: Do you want to participate in retirement plan (1 for yes 2 for no

Enter hours worked: 10 Enter the shift which you worked in: ours worked: 10 Hourly pay rate: $17.0 Regular pay: $170.0 Overti

Add a comment
Know the answer?
Add Answer to:
Acme Parts runs a small factory and employs workers who are paid one of three hourly...
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
  • 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...

  • Continuing Payroll Problem, 2B: Chapter 2 Olney Company, Inc. is a small manufacturing firm located in...

    Continuing Payroll Problem, 2B: Chapter 2 Olney Company, Inc. is a small manufacturing firm located in Newtown, Pennsylvania. The company has a workforce of both hourly and salaried employees. Each employee is paid for hours actually worked during each week, with the time worked being recorded in quarter-hour increments. The standard workweek consists of 40 hours, with all employees being paid time and one-half for any hours worked beyond the 40 regular hours. Wages are paid every Friday, with one...

  • Continuing Payroll Problem, 2B: Chapter 2 Olney Company, Inc. is a small manufacturing firm located in...

    Continuing Payroll Problem, 2B: Chapter 2 Olney Company, Inc. is a small manufacturing firm located in Allentown, Pennsylvania. The company has a workforce of both hourly and salaried employees. Each employee is paid for hours actually worked during each week, with the time worked being recorded in quarter-hour increments. The standard workweek consists of 40 hours, with all employees being paid time and one-half for any hours worked beyond the 40 regular hours. Wages are paid every Friday, with one...

  • Note: In this chapter and in all succeeding work throughout the course, unless instructed otherwise, calculate...

    Note: In this chapter and in all succeeding work throughout the course, unless instructed otherwise, calculate hourly rates and overtime rates as follows: 1. Carry the hourly rate and the overtime rate to 3 decimal places and then round off to 2 decimal places (round the hourly rate to 2 decimal places before multiplying by one and one-half to determine the overtime rate). 2. If the third decimal place is 5 or more, round to the next higher cent. 3....

  • Note: In this chapter and in all succeeding work throughout the course, unless instructed otherwise, calculate...

    Note: In this chapter and in all succeeding work throughout the course, unless instructed otherwise, calculate hourly rates and overtime rates as follows: 1. Carry the hourly rate and the overtime rate to 3 decimal places and then round off to 2 decimal places (round the hourly rate to 2 decimal places before multiplying by one and one-half to determine the overtime rate). 2. If the third decimal place is 5 or more, round to the next higher cent. 3....

  • Continuing Payroll Problem, 2A: Chapter 2 Kipley Company is a small manufacturing firm located in Pittsburgh,...

    Continuing Payroll Problem, 2A: Chapter 2 Kipley Company is a small manufacturing firm located in Pittsburgh, Pennsylvania. The company has a workforce of both hourly and salaried employees. Each employee is paid for hours actually worked during each week, with the time worked being recorded in quarter-hour increments. The standard workweek consists of 40 hours, with all employees being paid time and one-half for any hours worked beyond the 40 regular hours. Wages are paid every Friday, with one week's...

  • Problem 1 (Aggregate planning): Martin Trailers (MT) is a manufacturer of small camping and snowmobile trailers...

    Problem 1 (Aggregate planning): Martin Trailers (MT) is a manufacturer of small camping and snowmobile trailers in Ontario (lvey case #9A82D006). The demand for the camping trailers occurs between Jan and Jun of each year (mostly in Apr and May). Aggregate demand (in units) is: Jan 450 Feb 525 Mar 675 Apr 1005 May 1,125 Jun. 600 MT employs 40 permanent workers who are paid $20 per hour and each worker works 150 hours per month. Together they make approx....

  • Alexander Wilson operates Metroplex Courier and Delivery Service. He has four employees who are paid on an hourly basis. During the workweek beginning December 15 and ending December 21, 2019, his em...

    Alexander Wilson operates Metroplex Courier and Delivery Service. He has four employees who are paid on an hourly basis. During the workweek beginning December 15 and ending December 21, 2019, his employees worked the number of hours shown below Information about their hourly rates, marital status, and withholding allowances also appears below, along with their cumulative earnings for the year prior to the December 15-21 payroll period. Consider any hours worked beyond 40 in the week as overtime hours and...

  • Employees who work for government agencies or municipalities have long been permitted to take time off,...

    Employees who work for government agencies or municipalities have long been permitted to take time off, rather than receiving extra pay when they work over 40 hours a week. This compensatory time option allows the employee to receive the equivalent of one and one half hours for each hour of overtime worked in time off. Law enforcement, fire protection, emergency response personnel, and employees engaged in seasonal activities may accrue up to 480 hours of comp time, and all other...

  • The manufacturing division manager of Davison Enterprises has submitted the following production forecast (in units) for...

    The manufacturing division manager of Davison Enterprises has submitted the following production forecast (in units) for each quarter of the next fiscal year. The plant produces seats for motorcycles: Units to be produced First Quarter 10,750 Second Quarter 10, 150 Third Quarter 10,250 Fourth Quarter 10,650 Each unit requires 0.40 direct labour-hours, and employees are paid $8 per hour. Required: 1. Prepare the company's direct labour budget for the upcoming fiscal year, assuming that the direct labour workforce is adjusted...

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