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
What cold, hard facts support your position?
Sladkaya [172]
Idk what is it?
a computer?
plz mark me as brainliest
6 0
3 years ago
If you insert a picture, resize and reposition it, and then change to a different picture, you must modify the new picture to
Mashcka [7]

Answer:

false , that is not true

Explanation:

because a person can change to a different picture , but it Is not by force it will have a match to the original

3 0
2 years ago
Read 2 more answers
Write a for loop that prints the integers 50 through 1, each on a separate line. use no variables other than count.
Anton [14]
For( count = 50; count > 0; count-- )
    System.out.println( count );
5 0
3 years ago
In the early days of photography, cameras were limited to professional photographers because of the knowledge needed to work the
FinnZ [79.3K]
True they had to be developed in a special way in a dark room with several chemicals. 
3 0
3 years ago
Read 2 more answers
PYTHON!
SashulF [63]

Explanation:

<h2>hi dude 15 Alignment, font styles, and horizontal rules</h2><h2>Contents</h2><h2 /><h2>Formatting</h2><h2>Background color</h2><h2>Alignment</h2><h2>Floating objects</h2><h2>Float an object</h2><h2>Float text around an object</h2><h2>Fonts</h2><h2>Font style elements: the TT, I, B, BIG, SMALL, STRIKE, S, and U elements</h2><h2>Font modifier elements: FONT and BASEFONT</h2><h2>Rules: the HR element</h2><h2>This section of the specification discusses some HTML elements and attributes that may be used for visual formatting of elements. Many of them are deprecated.</h2><h2 /><h2>15.1 Formatting</h2><h2>15.1.1 Background color</h2><h2>Attribute definitions</h2><h2 /><h2>bgcolor = color [CI]</h2><h2>Deprecated. This attribute sets the background color for the document body or table cells.</h2><h2>This attribute sets the background color of the canvas for the document body (the BODY element) or for tables (the TABLE, TR, TH, and TD elements). Additional attributes for specifying text color can be used with the BODY element.</h2><h2 /><h2>This attribute has been deprecated in favor of style sheets for specifying background color information.</h2><h2 />

15.1.2 Alignment

<h3>It is possible to align block elements (tables, images, objects, paragraphs, etc.) on the canvas with the align element. Although this attribute may be set for many HTML elements, its range of possible values sometimes differs from element to element. Here we only discuss the meaning of the align attribute for text.</h3><h2 /><h2>Attribute definitions</h2><h2 /><h2>align = left|center|right|justify [CI]</h2><h3>Deprecated. This attribute specifies the horizontal alignment of its element with respect to the surrounding context. Possible values:</h3>

left: text lines are rendered flush left.

center: text lines are centered.

right: text lines are rendered flush right.

justify: text lines are justified to both margins.

The default depends on the base text direction. For left to right text, the default is align=left, while for right to left text, the default is align=right.

3 0
3 years ago
Other questions:
  • Each time an end user clicks a hyperlink, the browser generates a(n) _____ page request that is sent to the designated web serve
    12·1 answer
  • Your bank contacts you asking you to phone a number supplied in the email.What do you?
    13·2 answers
  • The identification of critical information is a key part of the OPSEC process because: a) It is required by the JTF commander to
    13·1 answer
  • What is the purpose of the print area feature​
    11·1 answer
  • g Write a program that prompts the user for an integer n between 1 and 100. If the number is outside the range, it prints an err
    5·1 answer
  • What does this say in morse code?
    11·2 answers
  • Write a program that accepts two integers from the user and perform one of the four arithmetic operations based on user’s choice
    11·1 answer
  • WHY DO YOU DElete EVERY QUESTIONS THAT IS ASKED! Im a freaking guy, yes and i wont followers for my channel so leave me alone!
    7·2 answers
  • Fire stick optimizing system storage and applications
    10·1 answer
  • You can enter common data in multiple worksheets by __________.
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!