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 server role provides IEEE 802.1X authentication features? (Points : 5) File services
Citrus2011 [14]

Answer:Network policy and access services

Explanation: IEEE 802.1X is standard which stands for Port-based Network access control (PNAC). The authentication process of IEEE 802.1X is accessing should be managed through server, presence security factor , policies of network are managed and supported by network policy server .

The device that want to be connected with LAN or wireless LAN get though this authentication process.Other options are incorrect because files services, web servers and active directory domain services are not the factor that considered for authentication in IEEE 802.1X.

7 0
3 years ago
A7DF is the hexadecimal representation for what bit pattern?
kipiarov [429]

Answer:

1010 0111 1101 1111

Explanation:

A = 10 in decimal = 1010 in binary

7 = 7 in decimal = 0111 in binary

D = 13 in decimal = 1101 in binary

F = 15 in decimal = 1111 in binary

Therefore 0xA7DF = 1010 0111 1101 1111 in binary

6 0
3 years ago
Clunker Motors Inc. is recalling all vehicles in its Extravagant line from model years 1999-2002 as well all vehicles in its Guz
Aleksandr [31]

Answer:

The following code is written in java programming language:

//set if statement

if (((modelYear >= 1999) && (modelYear <= 2002) && (modelName == "Extravagant")) || ((modelYear >= 2004) && (modelYear <= 2007) && (modelName == "Guzzler")))

{

recalled = true;    //initialized Boolean value

}

else      //set else statement

{

recalled = false; ////initialized Boolean value

}

Explanation:

Here, we set the if statement and set condition, if the value of modelYear is greater than equal to 1999 and less that equal to 2002 and modelName is equal to "Extravagant" or the value of modelYear is greater than equal to 2004 and less than equal to 2007 and the model year is equal to "Guzzler", than "recalled" initialized to "true".

Otherwise "recalled" initialized to "true".

5 0
3 years ago
When you use the tilde operator (~ in a url for the attribute of a server control, it represents the _____ directory of the webs
LuckyWell [14K]
~ usually represents the home directory( or the directory from which each user's repository is immediately accessible.
none of the options are necessarily correct
6 0
2 years ago
Which of the following information sources was not directly affected by the Telecommunications Act of 1996?
RUDIKE [14]
The answer is 'D', as obvious as it seems...
4 0
2 years ago
Other questions:
  • Audio editing software contains several codecs that allow you to
    15·1 answer
  • What is a correlation and how does it relate to inferential error?
    5·1 answer
  • 8.5 question 2 edhesive
    11·1 answer
  • Create a list words = ['is', 'NLP', 'fun', '?']. Use a series of assignment statements (e.g. words[1] = words[2]) and a temporar
    12·1 answer
  • "Hubs:
    9·1 answer
  • You upgrade a graphics workstation with a HyperThreading-enabled CPU core. You expect the programs on the desktop to run much fa
    12·1 answer
  • A(n) ______ has moving mechanical parts, which makes it less reliable than solid-state drives, but its metal platters are sealed
    9·2 answers
  • Question 12
    13·1 answer
  • Which option should Gina click to edit the text contained in a text box on a slide in her presentation?
    10·1 answer
  • Explain why you would use the soft on/off jumper when working on ATX system
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!