Question

PAYROLL FRO Employees at a store are paid daily wages according to the following rules • Each employee is paid the same fixed
The bonus threshold is calculated based on the number of items sold by day. The employee with the greatest number of sales an
B. The compute The computewages method is intended to calculate the wages for each employee and to assig them to the appropri
the parameter perItemWage represents the amount each employee * is paid per item sold. public void computeWages (double fixed
0 0
Add a comment Improve this question Transcribed image text
Answer #1

In case of any query do comment, Please rate answer as well. Thanks

Code:

========payroll.java======

public class Payroll
{
private int[] itemsSold;
  
private double[] wages;
  
//constructor is just kept for demonstrating the code output
public Payroll()
{
itemsSold = new int[] {48,50,37,62,38,70,55,37,64,60};
wages = new double[10];
}
  
/*
to compute Bonus Threshold, you have to find sum Of Items Sold, highest and lowest
deduct highest and lowest from sum Of Items Sold and then divide by number of items -2
to find the bonus Threshold
*/
public double computeBonusThreshold()
{
int highest = itemsSold[0];
int lowest = itemsSold[0];
int sumOfItemsSold = itemsSold[0];
  
double bonusThreshold =0;
  
//iterate over items , find sum of items sold and highest and lowest
for (int i = 1; i < itemsSold.length ; i++)
{
sumOfItemsSold += itemsSold[i];
  
if(itemsSold[i] > highest)
highest = itemsSold[i];
  
if(itemsSold[i] < lowest )
lowest = itemsSold[i];
}
  
bonusThreshold = (sumOfItemsSold - lowest - highest ) / (itemsSold.length -2.0);
  
return bonusThreshold;
}
  
/*
Compute wages as asked, wage for an employee is fixed wage added with itemSold * perItemWage
When an employee sold items more than bonus Threshold Items then he will get extra 10%
*/
public void computeWages(double fixedWage, double perItemWage)
{
double bonusThresholdForWages = computeBonusThreshold();
for (int i = 0; i < wages.length ; i++)
{
wages[i] = fixedWage + ( itemsSold[i] * perItemWage);
  
if(itemsSold[i] > bonusThresholdForWages)
{
wages[i] = wages[i] * 1.1 ; //which is 10 % extra of current wage of employee
}
}
}
  
/*
Method to show itemsold, wages for the employee
*/
public void printWages()
{
for (int i = 0; i < wages.length ; i++)
{
System.out.printf("Employee =%d , ItemsSold = %d, Wage = %.2f\n",i,itemsSold[i], wages[i]);
}
}
}

=========main.java======

public class Main
{
   public static void main(String[] args) {
       //create an object of payroll class, where itemsSolds are hard coded for demo
       Payroll payroll = new Payroll();
      
       System.out.println("Bonus threshold items are : " + payroll.computeBonusThreshold());
      
       //call computeWages which will internally class bonus threshold as well
       payroll.computeWages(10.0,1.5);
      
       payroll.printWages();
   }
}

=============screen shot of code for indentation======

Menjava Payroll av i 1 public class Payroll private int[] itens Sold; private double[] wages; //constructor is just kept for

Main.java Payroll.java: 1 public class Main 2- { public static void main(String[] args) { //create an object of payroll class

output:

input Bonus threshold items are : 51.75 Employee =0, Items Sold = 48, Wage = 82.00 Employee =1 , Items Sold = 50, Wage = 85.0

Add a comment
Know the answer?
Add Answer to:
PAYROLL FRO Employees at a store are paid daily wages according to the following rules •...
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
  • c++ (Don't use array) OBJECT:To compute the payroll in a company of 10 employees, given an...

    c++ (Don't use array) OBJECT:To compute the payroll in a company of 10 employees, given an employee's id number pay rate, number of hours, and tax rate. INPUT: For each amployce, his id number, pay rate and number of hours. You will prompt the user with a friendly message to enter an employee's id number, pay rate and number of hours Employee ID 101 150 net pay 460.00 570.00 OUTPUT: gross pay 500.00 600.00 Also print at the end, the...

  • PART 1 Palm Corporation had total payroll of$600,000. For this payroll period, the company withheld 20%...

    PART 1 Palm Corporation had total payroll of$600,000. For this payroll period, the company withheld 20% for employee income taxes. The FICA tax rate is 7.65% for wages on each employee up to their first $1 00,000 of earnings, and 1 .45% for earnings in excess of $ 1 00,000. The employer must match the employee's FICA withholding with an equal amount as employer payroll taxes. In addition, the employer must pay state and federal unemployment taxes on the first...

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

  • In the processLineOfData method, write the code to handle case "H" of the switch statement such...

    In the processLineOfData method, write the code to handle case "H" of the switch statement such that: • An HourlyEmployee object is created using the firstName, lastName, rate, and hours local variables. Notice that rate and hours need to be converted from String to double. You may use parseDouble method of the Double class as follows: Double.parseDouble(rate) Call the parsePaychecks method in this class passing the Hourly Employee object created in the previous step and the checks variable. Call the...

  • Java Description Write a program to compute bonuses earned this year by employees in an organization....

    Java Description Write a program to compute bonuses earned this year by employees in an organization. There are three types of employees: workers, managers and executives. Each type of employee is represented by a class. The classes are named Worker, Manager and Executive and are described below in the implementation section. You are to compute and display bonuses for all the employees in the organization using a single polymorphic loop. This will be done by creating an abstract class Employee...

  • 1. Sheffield Enterprises’ payroll for the month of March, 2020 is shown below. Salaries and Wages...

    1. Sheffield Enterprises’ payroll for the month of March, 2020 is shown below. Salaries and Wages for the month of March 2020 $ 214,000 Income Taxes withheld from employees 47,372 EI withheld from employees 1.66% CPP withheld from employees 4.95% Union dues withheld from employees 20,914 Prepare the journal entries for the employee and employer portion related to payroll costs. Also, prepare the journal entries to record the remittance of the March payroll deductions to the Receiver General for Canada...

  • eBook Show Me How Calculator Print Item Calculate Payroll Breakin Away Company has three employees-a consultant,...

    eBook Show Me How Calculator Print Item Calculate Payroll Breakin Away Company has three employees-a consultant, a computer programmer, and an administrator. The following payroll information is available for each employee Consultant Administrator Computer Programmer $30 per hour 1.5 times hourly rate $48 per hour Regular earnings rate Overtime earnings rate Number of withholding allowances For the current pay period, the computer programmer worked 60 hours and the administrator worked 50 hours. The federal income tax withheld for all three...

  • Payroll Accounting Jet Enterprises has the following data available for its April 30, 2019, payroll: Wages...

    Payroll Accounting Jet Enterprises has the following data available for its April 30, 2019, payroll: Wages earned $485,000 * Federal income taxes withheld 92,300 * All subject to Social Security and Medicare matching and withholding of 6.2% and 1.45%, respectively. Federal unemployment taxes of 0.70% and state unemployment taxes of 0.90% are payable on $405,700 of the wages earned. Required: If required, round your answers to the nearest cent. 1. Compute the amounts of taxes payable and the amount of...

  • The names of the employees of Hogan Thrift Shop are listed on the following payroll register. Emp...

    The names of the employees of Hogan Thrift Shop are listed on the following payroll register. Employees are paid weekly. The marital status and the number of allowances claimed are shown on the payroll register, along with each employee's weekly salary, which has remained the same all year. Complete the payroll register for the payroll period ending December 20, the 51st weekly payday. The state income tax rate is 2% of total earnings, the city income tax rate is 1.5%...

  • Please complete all required lines Employees are paid weekly on Friday. The following paydays occurred during this qua...

    Please complete all required lines Employees are paid weekly on Friday. The following paydays occurred during this quarter: July August September 5 weekly paydays 4 weekly paydays 4 weekly paydays Taxes withheld for the 13 paydays in the third quarter follow: Employees’ Weekly Weekly Federal Income Tax FICA Taxes Withheld on Wages FICA Taxes on Tips OASDI HI OASDI HI $700 per week Employees' $500.65 $117.11 Employees' $48.07 $11.24 Employer's 500.65 117.09 Employer's 48.07 11.24 Based on the information given,...

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