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

  • Stark Company has five employees. Employees paid by the hour earn $10 per hour for the...

    Stark Company has five employees. Employees paid by the hour earn $10 per hour for the regular 40-hour workweek and $15 per hour beyond the 40 hours per week. Hourly employees are paid every two weeks, but salaried employees are paid monthly on the last biweekly payday of each month. FICA Social Security taxes are 6.2% of the first $128,400 paid to each employee, and FICA Medicare taxes are 1.45% of gross pay. FUTA taxes are 0.6% and SUTA taxes...

  • Stark Company has five employees. Employees paid by the hour earn $10 per hour for the regular 40-hour workweek and $15 per hour beyond the 40 hours per week. Hourly employees are paid every two weeks, but salaried employees are paid monthly on the last b

    Stark Company has five employees. Employees paid by the hour earn $10 per hour for the regular 40-hour workweek and $15 per hour beyond the 40 hours per week. Hourly employees are paid every two weeks, but salaried employees are paid monthly on the last biweekly payday of each month. FICA Social Security taxes are 6.2% of the first $137,700 paid to each employee, and FICA Medicare taxes are 1.45% of gross pay. FUTA taxes are 0.6% and SUTA taxes...

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

    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 Computer Programmer Administrator Regular earnings rate Overtime earnings rate $3,110 per week Not applicable $28 per hour 1.5 times hourly rate $48 per hour 2 times hourly 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...

  • Calculate Payroll Breakin Away Company has three employees a consultant, a computer programmer, and an administrator....

    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 Computer Programmer Administrator Regular earnings rate $2,310 per week $48 per hour Overtime earnings rate $28 per hour 1.5 times hourly rate Not applicable 2 times hourly 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...

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

  • Stark Company has five employees. Employees paid by the hour earn $15 per hour for the...

    Stark Company has five employees. Employees paid by the hour earn $15 per hour for the regular 40-hour workweek and $20 per hour beyond the 40 hours per week. Hourly employees are paid every two weeks, but salaried employees are paid monthly on the last biweekly payday of each month. FICA Social Security taxes are 6.2% of the first $128,400 paid to each employee, and FICA Medicare taxes are 1.45% of gross pay. FUTA taxes are 0.6% and SUTA taxes...

  • Paloma Co. has four employees. FICA Social Security taxes are 6.2% of the first $128,400 paid...

    Paloma Co. has four employees. FICA Social Security taxes are 6.2% of the first $128,400 paid to each employee, and FICA Medicare taxes are 1.45% of gross pay. Also, for the first $7,000 paid to each employee, the company's FUTA taxes are 0.6% and SUTA taxes are 5.4%. The company is preparing its payroll calculations for the week ended August 25. Payroll records show the following information for the company's four employees. Name Dali Trey Kiesha Chee Gross Pay through...

  • Stark Company has five employees. Employees paid by the hour earn $14 per hour for the...

    Stark Company has five employees. Employees paid by the hour earn $14 per hour for the regular 40 hour workweek and $19 per hour beyond the 40 hours per week. Hourly employees are paid every two weeks, but salaried employees are paid monthly on the last biweekly payday of each month. FICA Social Security taxes are 6.2% of the first $128,400 paid to each employee, and FICA Medicare taxes are 1.45% of gross pay. FUTA taxes are 0.6% and SUTA...

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