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
Which sources could provide reliable evidence for your claim? Check all that apply. a step-by-step guide listed at www.gettingto
kozerog [31]
The correct answer is:
<span>an article from the New York Times</span>a book by an educational researcher and  professor<span>a report from the US Department of Education at www.ed.gov</span>
7 0
2 years ago
Read 2 more answers
Explain why each of the following names does or does not seem like a good variable name to represent a state sales tax rate.
tatyana61 [14]

a. stateTaxRate  - A good variable name because it represents what it holds, the state sales tax rate, without being too wordy. Also correctly capitalized in camelcase.

b. txRt  - A bad variable name because while short and simple, it is too hard to understand what the variable represents.

c. t  - A very bad variable name if you plan on using the variable often. Far too short and you will forget what it represents and is needed for.

d. stateSalesTaxRateValue  - A bad variable name because it is just too wordy. Cutting it down to A's variable name is much more reasonable

e. state tax rate  - A bad variable name and probably invalid because it has spaces in the name.

f. taxRate  - A good variable name if there are no other tax calculations other than state tax rate. Otherwise you would confuse state vs local tax rate or something, making it a bad variable name.

g. 1TaxRate  - A bad variable name because the number 1 has no reason being in the variable name. It doesn't add anything to the name.

h. moneyCharged - A bad variable name because it is not specific enough in explaining why the money is being charged and what for.

7 0
2 years ago
Modify the guessing-game program so that the user thinks of a number that the computer must guess.
Triss [41]

Answer:

import random

import math

smaller = int(input("Enter the smaller number: "))

larger = int(input("Enter the larger number: "))

count = 0

print()

while True:

   count += 1

   myNumber = (smaller + larger) // 2

   print('%d %d' % (smaller, larger))

   print('Your number is %d' % myNumber)

   choice = input('Enter =, <, or >: ')

   if choice == '=':

       print("Hooray, I've got it in %d tries" % count)

       break

   elif smaller == larger:

       print("I'm out of guesses, and you cheated")

       break

   elif choice == '<':

       larger = myNumber - 1

   else:

       smaller = myNumber + 1

Explanation:

The code to be Modified is as indicated below:

# Modify the code below:

import random

smaller = int(input("Enter the smaller number: "))

larger = int(input("Enter the larger number: "))

myNumber = random.randint(smaller, larger)

count = 0

while True:

   count += 1

   userNumber = int(input("Enter your guess: "))

   if userNumber < myNumber:

       print("Too small")

   elif userNumber > myNumber:

       print("Too large")

   else:

       print("You've got it in", count, "tries!")

       break

Detailed Explanation:

Line 3 and 4 of the codes prompts the user to enter a smaller and larger number. Line 5 we initiate the formula for minimum number of guesses. Line 14 and 17 prints out the output  I'm out of guesses, and you cheated and Hooray, I've got it in X after validating the conditions.

7 0
2 years ago
Mary is writing an article about the animal kingdom. She wants to place image below the text. Which menu should Mary choose for
marysya [2.9K]

The Wrap Text menu.

The positioning of text in Word is sometimes not lined up with the inserted picture. By default, when you insert an image or a picture, its layout is set to inline with text. To change that, double click on the picture and then click the Wrap Text option. A number of options will pop up with text graphics.


7 0
2 years ago
Read 2 more answers
Lai worked on a global team for an American company, and all her work had to be completed in her second language, English. Somet
N76 [4]

Answer:

E) Encoding.

Explanation:

Communication is important aspect of life.Communication barriers occurs at all stages of communication from when the sender sends the message to the receiver receiving the message. Lack of communication skill in that particular comes in encoding barrier.So we conclude that the answer is Encoding.

4 0
2 years ago
Read 2 more answers
Other questions:
  • Which command suppresses the visibility of a particular Row or column in a worksheet?
    9·1 answer
  • Fill in the blank; "As well as their traditional role of computing data, computers are also extensively used for..."
    14·1 answer
  • The kings and queens of England are listed in a relation Kings(name,nickname,house,beginReign,endReign). Their name is unique, e
    8·1 answer
  • At one college, the tuition for a full-time student is $8,000 per semester. It has been announced that the tuition will increase
    13·1 answer
  • Write a client program that writes a struct with a privateFIFO name (call it FIFO_XXXX, where XXXX is the pid that you got from
    11·1 answer
  • Q3** Write a query to create a new price list for books written by the same author. Allow the user to enter only the first 4 let
    15·1 answer
  • Ana works in the medical records department at a large medical office. Her job includes scanning and uploading medical records i
    15·1 answer
  • Define a method printAll() for class PetData that prints output as follows with inputs "Fluffy", 5, and 4444. Hint: Make use of
    13·1 answer
  • Assume your friend just sent you 32 bits of pixel data (just the 0s and 1s for black and white pixels) that were encoded after s
    14·1 answer
  • The maximum number of times the decrease key operation performed in Dijkstra's algorithm will be equal to ___________
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!