Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Assume that the classes listed in the Java Quick Reference have

HOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA.

  • Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
  • Unless otherwise noted in the question, assume that parameters in method calls are notnulland that methods are called only when their preconditions are satisfied.
  • In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question. Writing significant amounts of code that can be replaced by a call to one of these methods will not receive full credit.

Employees at a store are paid daily wages according to the following rules.

  • Each employee is paid the same fixed amount per day.
  • Each employee is paid an additional amount for each item they sold on that day.

Daily Bonus:

If the number of items sold that day by an employee is greater than a computed threshold, then the employee also receives a bonus equal to10

percent of the employee's daily wages.

You will write two methods in thePayrollclass below.

public class Payroll

{

private int[] itemsSold;/umber of items sold by each employee

private double[] wages; //wages to be computed in part (b)

/**Returns the bonus threshold as described in part (a).

*/

public double computeBonusThreshold()

{

/*To be implemented in part (a)*/

}

/**Computes employee wages as described in part (b)

*and stores them inwages.

*The parameterfixedWagerepresents the fixed amount each employee

*is paid per day.

*The parameterperItemWagerepresents the amount each employee

*is paid per item sold.

*/

public void computeWages(double fixedWage, double perItemWage)

{

/*To be implemented in part (b)*/

}

//Other instance variables, constructors, and methods not shown.

}

The bonus threshold is calculated based on the number of items sold by all employees on a given day. The employee with the greatest number of sales and the employee with the least number of sales on that day are ignored in the calculation. The average number of items sold by the remaining employees on that day is computed, and this value is used as the bonus threshold.

For a given day, the number of items sold by each employee is stored in the arrayitemsSold. The example below shows the contents ofitemsSoldfor a day in which there were ten employees. Each array index represents an individual employee. For example,itemsSold[3]represents the number of items sold by employee 3.

image text in transcribedimage text in transcribed
\f\f

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions