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
after turning the volume all the way up on the speakers you still can't hear any sound which of the following should be your the
ivolga24 [154]

Answer:

check if its pluged in

Explanation:

7 0
4 years ago
An expansion ____ is a long-narrow socket on the motherboard into which you can plug an expansion card.
Valentin [98]
The answer is
An expansion Slot
7 0
3 years ago
Alarm filtering may be based on combinations of frequency, similarity in attack signature, similarity in attack target, or other
dezoksy [38]

Answer: False

Explanation:

 The given statement is false, as the alarm filtering is the process of classifying the various type of IDPS alert in the system and it can be managed more efficiently.

The IDPS administrator can easily set an alarm filtering in the running system. It can generate the various types of positive tract in the system and then adjust the different alarm classifications. Alarm filters are same as the packet filter in which they can easily filter the items from the source and destination IP address.

3 0
3 years ago
Which object waits for and responds toan event from a GUI component?
irakobra [83]

Answer:

The answer is action eventlistener

Explanation:

It is an event handler and it is easy to implement.In java we call them even listeners it is function or a sub routine or a procedure that waits for an event to occur and respond to an event from a GUI component.

8 0
3 years ago
1-5. Discuss briefly the function and benefits of computer network. (5pts​
Elden [556K]

Computer networks allow an unlimited amount of computers to communicate with each other. This is especially useful in enterprise environments, as technicians have to deal with hundreds of computers at a time. Computer networks make it easier to share files, increase storage capacity, better communication, easier to to control computers remotely, easier to share resources, ability to share a single internet connection on multiple devices. Computer networks also have a lot of cost benifits too, as network administration is centralised, meaning that less IT support is required, and you can cut costs on sharing peripherals and internet access.

Hopefully this helps you out!

7 0
3 years ago
Other questions:
  • I WILL MARK THE BRAINIEST!!!!!!!!!!!!! 50 POINTS!!!!!!!
    5·2 answers
  • Which one of the following is not the name of a 20th century school composition
    14·2 answers
  • Create a script that will find the sum of the all multiples of 3 between 1 and 1000 by using For Loop. (Pseudo Code required) 3.
    7·1 answer
  • The Internet Engineering Task Force (IETF) defines the protocols and standards for how the Internet works. The members of the IE
    12·1 answer
  • Chapter 12 Reading Question 19 The most distinguishing characteristic of geographical information systems is: Every record or di
    5·1 answer
  • ___________ is related to mass, but also includes the gravitational pull of the Earth.
    14·1 answer
  • 10. Why antivirus is needed to be installed in computer system?
    8·1 answer
  • Which of the following statements describes the general idea of an assistive media​
    7·1 answer
  • How does the variance as a measure of the dispersion of a data set relate to the measure of central tendency (i.e. mean)? What c
    14·1 answer
  • Which model allows designers to use a graphical tool to examine structures rather than describing them with text?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!