subject

SHOW 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 not null and 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 to

10

percent of the employee’s daily wages.

You will write two methods in the Payroll class below.

public class Payroll

{

private int[] itemsSold; // number 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 in wages.

* The parameter fixedWage represents the fixed amount each employee

* is paid per day.

* The parameter perItemWage represents 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 array itemsSold. The example below shows the contents of itemsSold for 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.
(REFER TO TABLE 1)
Based on the information in the table, the bonus threshold is calculated as follows.
(48+50+37+62+38+70+55+37+64+60)−37− 70
8
=51.75
(a) Complete the method computeBonusThreshold below, which is intended to return the bonus threshold based on the contents of the itemsSold array. Assume that itemsSold has been filled appropriately and that the array contains at least three employees.
/** Returns the bonus threshold as described in part (a).
*/
public double computeBonusThreshold()
The computeWages method is intended to calculate the wages for each employee and to assign them to the appropriate element of the array wages. For example, wages[3] should be assigned the wages for employee 3. An employee’s wages consist of their daily wages plus a possible bonus and are calculated as follows.
Each employee’s wages are equal to the fixed wage plus the number of items sold times the amount paid per item sold.
If the employee sold more items than the bonus threshold, the employee also receives a 10 percent bonus added to their wages.
As described in part (a), computeBonusThreshold() returns 51.75 for the example array below.
(REFER TO TABLE 2)
Suppose that fixedWage is 10.0 and perItemWage is 1.5.
Employee 0 did not sell more items than the bonus threshold, so employee 0’s wages are equal to 10.0 + 1.5 * 48, which evaluates to 82.0. This value will be assigned to wages[0].

Employee 9 sold more items than the bonus threshold, so employee 9 receives a 10 percent bonus. Employee 9’s wages are equal to (10.0 + 1.5 * 60) * 1.1, or 110.0. This value will be assigned to wages[9].

(b) Write the method computeWages. Assume that itemsSold has been filled appropriately, and there are at least three employees in the array. Assume also that the wages array and the itemsSold array have the same length. Your solution must call computeBonusThreshold appropriately to receive full credit.
/** Computes employee wages as described in part (b)
* and stores them in wages.
* The parameter fixedWage represents the fixed amount each employee
* is paid per day.

* The parameter perItemWage represents the amount each employee

* is paid per item sold.

*/

public void computeWages(double fixedWage, double perItemWage)


SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Assume that the classe
SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Assume that the classe

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:20
Geneva’s manager would like to see some additional information to make sales decisions.enter a formula in cell j4 using the if function to it whether or not the item beaded earrings should go on sale. it will go on sale if its current sales rank (in cell g4) is 8th or lower. (hint: if the cell value is greater than or equal to 8, it will go on sale.)if this condition is true, the item will go on sale. (hint: the if_true value should be “yes”.)if this condition is false, the item doesn’t need to go on sale. (hint: the if_false value should be “-”.)copy the formula created in cell j4 to the range j5: j14
Answers: 2
question
Computers and Technology, 22.06.2019 07:00
Our primary purpouse as electricians is to do wich of the following core concepts? a: install electrical components in a way they can be upgraded b: install electrical equiptment in a way that reduces heat c: install electrical systems in a safe manner d: only b and c
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
Select the correct answer. a company is currently focusing on creating specific management goals for itself. which level of maturity is the company demonstrating under the sse_ccm framework? a. performed informally b. planned and tracked c. quantitatively controlled d. well-defined e. continuously improving
Answers: 2
question
Computers and Technology, 24.06.2019 08:30
Why might you choose to create a functional resume
Answers: 1
You know the right answer?
SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA.

Assume tha...
Questions
question
Mathematics, 04.06.2021 02:00
question
Mathematics, 04.06.2021 02:00
question
Spanish, 04.06.2021 02:00
Questions on the website: 13722363