answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
aivan3 [116]
2 years ago
6

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

Computers and Technology
1 answer:
Eva8 [605]2 years ago
4 0

Answer:

See explaination

Explanation:

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();

}

}

See attachment for screenshot of codes for indentation.

You might be interested in
Jeff wants to be an archeologist. He found the information below and wants to properly cite it for his own use. The information
saw5 [17]
<span>“Detail Report for 15-1199.11-Archeologist.” O*NET OnLine. n.p., 2012. Web. 5 May 2013.</span>
7 0
1 year ago
Read 2 more answers
Explain what might happen if two stations are accidentally assigned the same hardware address?
Firdavs [7]

Answer: If two different station are addressed with the same hardware address then there are chances of occurrence of the failure in the network at irregular intervals.The failure or error will occur because of the both the devices are seen as one by the network due to same address.

An intelligent network system id used ,it can identify the error can help in the prevention of the failure.Other option for configuring the situation is assigning the MAC(media access control)address to devices which are unique in nature thus, no device can have same address.

5 0
1 year ago
Write a function called sum_scores. It should take four arguments, where each argument is the team's score for that quarter. It
saw5 [17]

Answer:

Here is the Python program which has a function sum_scores:

def sum_scores(score1, score2, score3, score4):

   sum = score1 + score2 + score3 + score4

   print(sum)    

sum_scores(14,7,3,0)

Explanation:

  • Method sum_scores takes four arguments, score1, score2, score3, score4.
  • The sum variable adds these four scores and stores the value of their addition.
  • Lastly print statement is used to print the value stored in sum variable which is the value obtained by adding the four scores.
  • Last statement calls the sum_scores method and passes four values to it which are 14,7,3,0
  • The output of the above program is:
  • 24
  • If you want to use return statement instead of print statement you can replace print(sum) with return sum. But in order to display the sum of the scores you can replace sum_scores(14,7,3,0) with print(sum_scores(14,7,3,0))
  • The program along with the output is attached as a screenshot.

5 0
2 years ago
Which word in brackets is most opposite to the word in capitals? PROSCRIBE (allow, stifle, promote, verify)​
Sunny_sXe [5.5K]

the answer would be stifle

7 0
2 years ago
Read 2 more answers
Define and test a function myRange. This function should behave like Python’s standard range function, with the required and opt
Cerrena [4.2K]

Answer:

Study Python’s help on range to determine the names, positions, and what to do with your function’s parameters.

Use a default value of None for the two optional parameters. If these parameters both equal None, then the function has been called with just the stop value. If just the third parameter equals None, then the function has been called with a start value as well. Thus, the first part of the function’s code establishes what the values of the parameters are or should be. The rest of the code uses those values to build a list by counting up or down.

6 0
1 year ago
Read 2 more answers
Other questions:
  • Multiple boolean expressions can be combined by using a logical operator to create ________ expressions.
    10·1 answer
  • Print "userNum1 is negative." if userNum1 is less than O. End with newline Convert userNum2 to 0 if userNum2 is greater than 8.
    10·1 answer
  • How many times does the following loop execute?int upperCaseLetters = 0;String str = "abcdEfghI";boolean found = false;for (int
    5·1 answer
  • Using Amdahl’s Law, calculate the speedup gain of an application that has a 60 percent parallel component for (a) two processing
    11·1 answer
  • Chris accidentally steps on another student’s foot in the hallway. He apologizes, but the other student does not want to hear it
    13·2 answers
  • Nathan would like to save his PowerPoint presentation as a video that can be replayed easily on any device at full quality. Whic
    14·1 answer
  • 1. Assign to maxSum the max of (numA, numB) PLUS the max of (numY, numZ). Use just one statement. Hint: Call FindMax() twice in
    7·1 answer
  • A laptop gets replaced if there's a hardware issue. Which stage of the hardware lifecycle does this scenario belong to?
    5·1 answer
  • When considering server consolidation, plan on running ___________ vCPUs per core.a. 1 to 2b. 3 to 4c. 4 to 6d. 6 to 8
    7·1 answer
  • Write a program that takes a single integer input from the user and stores it in a variable. Your program should increase the va
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!