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]
4 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]4 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
Raj’s computer just crashed and he lost most of his files. What should he do to avoid this problem in the future?
Elanso [62]
He should back up his data regularly
3 0
4 years ago
Read 2 more answers
I’m which scenario would someone most likely be using presentation software ?
timurjin [86]

Answer:

100% the first one. the other ones would either be documents or spreadsheets

Explanation:

because oBaMa

6 0
3 years ago
Read 2 more answers
A showChar Method
Lady bird [3.3K]

Answer: so I ask my teacher and this is what he said

Explanation:

4 0
3 years ago
What features could be improved in microsoft word?
Korolek [52]

Word (and the rest of the Office suit) suffers from feature creep and legacy cruft. This is a difficult problem because with so many users, removing features is impossible without upsetting a lot of people.

One option would be to split Word into two products: One, called Word, would be a completely new product with a clear focus on the experience of writing and formatting text. This would require ruthlessly cutting out any parts that don't support this goal, including some backwards compatibility.

The other product, called Word Classic, would maintain all the cruft that some people feel they might need. Since the experience would be so much worse, and the new Word would be more prominently displayed in the Office suit, this would help Word users gradually transition to the new product.

7 0
3 years ago
The seventh generation of PMS, entails the migration of computing resources (e.g., hardware, software, and data) to a remote dat
uranmaximum [27]

Answer:

The answer is

Explanation:

5 0
3 years ago
Other questions:
  • "a web server that is​ specially-built to manage and deliver business intelligence is called a​ _________."
    7·1 answer
  • A __________ acts as separate network that rests outside the secure network perimeter so untrusted users can access web servers
    10·1 answer
  • When performing conflict management, it is important to identify your;
    6·1 answer
  • How long would it take a 8 bit computer to calculate π to the thousandth place?
    8·1 answer
  • Describe Format Painter by ordering the steps Jemima should follow to make the format of her subheadings more
    6·1 answer
  • If you need to set up direct deposit, which information from your check would you likely need?
    7·2 answers
  • What do you need to know when buying screws<br>​
    12·2 answers
  • What would be the best thing you could do to prepare yourself to work for a company that has embraced globalization. A) learn ho
    12·2 answers
  • What was Bill Gates purpose for starting a business?
    12·1 answer
  • Visit on social networking site and look for the site's privacy policy.The link is typically found at the bottom of the page and
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!