Computers and Technology

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

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 00:40, 1fuzzybirdow6e0s
If you arrive at the same time as another user straight across from you yield if a. they flash your headlights at you b. you can’t see their turn signals c. you’re going street and they’re running d. you’re turning they’re going straight plz
Answers: 1
image
Computers and Technology, 22.06.2019 08:00, dramaqueenactr2040
Two technicians are discussing the common u-joint. technician a says its input and output speeds should be equal. technician b says that it normally has two yokes. which technician is correct?
Answers: 1
image
Computers and Technology, 23.06.2019 01:40, littlebirdd987
You have a linux system that has a 1000gb hard disk drive, which has a 90gb partition containing an ext4 filesystem mounted to the / directory and a 4gb swap partition. currently, this linux system is only used by a few users for storing small files; however, the department manager wants to upgrade this system and use it to run a database application that will be used by 100 users. the database application and the associated data will take up over 200gb of hard disk space. in addition, these 100 users will store their personal files on the hard disk of the system. each user must have a maximum of 5gb of storage space. the department manager has made it very clear that this system must not exhibit any downtime as a result of hard disk errors. how much hard disk space will you require, and what partitions would you need to ensure that the system will perform as needed? where would these partitions be mounted? what quotas would you implement? what commands would you need to run and what entries to /etc/fstab would you need to create? justify your answers.
Answers: 3
image
Computers and Technology, 23.06.2019 02:00, vivian2020
Read this excerpt from helen keller’s autobiography, the story of my life. have you ever been at sea in a dense fog, when it seemed as if a tangible white darkness shut you in, and the great ship, tense and anxious, groped her way toward the shore with plummet and sounding-line, and you waited with beating heart for something to happen? i was like that ship before my education began, only i was without compass or sounding-line, and had no way of knowing how near the harbour was. "light! give me light! " was the wordless cry of my soul, and the light of love shone on me in that very hour. . the morning after my teacher came she led me into her room and gave me a doll. the little blind children at the perkins institution had sent it and laura bridgman had dressed it; but i did not know this until afterward. when i had played with it a little while, miss sullivan slowly spelled into my hand the word "d-o-l-l." i was at once interested in this finger play and tried to imitate it. when i finally succeeded in making the letters correctly i was flushed with childish pleasure and pride. running downstairs to my mother i held up my hand and made the letters for doll. i did not know that i was spelling a word or even that words existed; i was simply making my fingers go in monkey-like imitation. in the days that followed i learned to spell in this uncomprehending way a great many words, among them pin, hat, cup and a few verbs like sit, stand and walk. based on this excerpt, which words best describe helen keller?
Answers: 2
Do you know the correct answer?
SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA.

Assume tha...

Questions in other subjects:

Konu
Mathematics, 10.12.2020 17:50
Konu
Biology, 10.12.2020 17:50
Konu
Advanced Placement (AP), 10.12.2020 17:50
Konu
Health, 10.12.2020 17:50