1answer.
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
zhannawk [14.2K]
3 years ago
6

Return the "centered" average of an array of ints, which we'll say is the mean average of the values, except ignoring the larges

t and smallest values in the array. If there are multiple copies of the smallest value, ignore just one copy, and likewise for the largest value. Use int division to produce the final average. You may assume that the array is length 3 or more.centeredAverage({1, 2, 3, 4, 100}) → 3centeredAverage({1, 1, 5, 5, 10, 8, 7}) → 5centeredAverage({-10, -4, -2, -4, -2, 0}) → -3

Computers and Technology
1 answer:
denpristay [2]3 years ago
3 0

Answer:

The code to this question can be defined as follows:

public double centeredAverage(ArrayList<Integer> nums) //defining a method centeredAverage that accepts an array nums

{

   if ((nums == null) || (nums.size() < 3))//define if block for check simple case value

   {

       return 0.0;//return float value

   }

   double sum = 0; //defining a double variable sum

   int smallest = nums.get(0);//defining integer variable and assign value

   int largest = nums.get(0);//defining integer variable and assign value

   for (int i = 0; i < nums.size(); i++) //defining for loop for stor ith value

   {

       int value = nums.get(i);//defining integer value variable to hold nums value

       sum = sum + value;//use sum variable for add value

       if (value < smallest)//defining if block to check value less then smallest

           smallest = value;//hold value in smallest variable  

       else if (value > largest)//defining else if block that checks value greater them largest value

           largest = value; //hold value in largest variable

   }

   sum = sum - largest - smallest;  // use sum to decrease the sum largest & smallest value

   return (sum / (nums.size() - 2)); //use return keyword for return average value

}

Explanation:

In the question, data is missing, that's why the full question is defined in the attached file please find it.

In the given code a method "centeredAverage" is used that accepts an array in its parameter and inside the method, if block is used that checks the cash value if it is true, it will return a float value.

In the next step, two integers and one double variable is defined, that use the conditional statement for check hold value in its variable and at the last use return keyword for return average value.

You might be interested in
In microsoft word, when you highlight existing text you want to replace, you’re in
Sergio039 [100]
 Hello <span>Christinamauffp2olwu</span><span>

Answer: In Microsoft Word, when you highlight existing text you want to replace, you're in insert mode.

Hope This Helps :-)
-Chris</span>
6 0
3 years ago
You use a cisco 2900 router in your network. you are considering purchasing and implementing the Unifield communications feature
Olenka [21]

Explanation:

License boot module c2900, technology-package uck9

7 0
3 years ago
Change the following sentences using 'used to
Alinara [238K]

Answer:

a. We <u>used to</u> go to school together.

b. How did you <u>use to</u> spend the winter evenings?

c. We <u>used to </u>have our milk delivered.

d. I <u>used to</u> be in love with him.

e. At one time there <u>used to</u> be trees in the garden.

5 0
3 years ago
One of the disadvantages of cable technology is that: while it works well for television signals, it is ineffective for data tra
nignag [31]

Answer:

systems used by many providers require customers to share bandwidth with neighbors

Explanation:

One of the disadvantages of cable technology is that systems used by many providers require customers to share bandwidth with neighbors. This ultimately causes many problems since cables would need to be extended to reach every single user that will be sharing the bandwidth. This would mean cables all over the place. Also, it is very difficult to limit the bandwidth per person, meaning that if anyone is using up all of the bandwidth through the cable, the rest of the individuals connected would not have the bandwidth that they need or are paying for.

7 0
2 years ago
~ I already know this ~ who was the bits victim in five nights at freddys 4 <br> ___10 points___
Andreas93 [3]

Answer:

i dont know anything about them only that the bear is the ducks son and the duck is the fox mom.

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • Kurt is editing a table in his powerpoint that displays accounting formulas and when to use them. he wants to remove the table s
    15·1 answer
  • If using the md5 hashing algorithm, what is the length to which each message is padded?
    11·1 answer
  • Which topology enables only one person, at one time, to send data to others on the network?
    6·1 answer
  • What is the basic difference between a printer and a plotter?​
    12·1 answer
  • Because it takes time to change an organization’s culture, the ISO must continually monitor security policy compliance. The ISO
    9·1 answer
  • Only technical managers needs to know about programming, web view source code and about technology issues.
    12·1 answer
  • What is one pass of a coding sequence called?​
    13·2 answers
  • Help plz!! I will mark brainliest
    15·2 answers
  • If you're a beginner to data analysis, what is the first thing you should check when you build data queries?
    11·1 answer
  • What are some other possible causes of an overheating laptop
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!