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
sergey [27]
3 years ago
14

Write a method that computes the average of the values in an array of doubles. The header of the method is as follows:

Computers and Technology
1 answer:
Ber [7]3 years ago
3 0

Answer:

Written in Java

public static double average(double[] x){

   double sum = 0.0;

   for(int i=0;i<x.length;i++){

       sum+=x[i];

   }

   return sum/x.length;

}

Explanation:

This defines the method

public static double average(double[] x){

This initializes sum to 0.0

   double sum = 0.0;

This iterates through the array

   for(int i=0;i<x.length;i++){

This adds up items of the array

       sum+=x[i];

   }

This returns the average

   return sum/x.length;

}

<em>Attached to this program is the full program that include the main method of the program</em>

Download txt
You might be interested in
assume a class named window has an accessor method named getwidth that accepts no parameters and returns an int. assume further
worty [1.4K]

The set and get functions are analogous to the accessor and mutator functions of C++. They are used in place of modifying a class member directly inside an object and making it public. An accessor function must be invoked in order to gain access to a private object member.

int mVal = winarr[0].getWidth();

for(int i = 1; i < winarrsize; i++)

{

  if(winarr[i].getWidth() > mxVal)

     mVal = winarr[i].getWidth();

}

cout << "The widest width is: "

<< mVal << endl;

By using encapsulation, a programmer can specify the labels for the data members and functions as well as whether or not other classes can access them. When data members are marked as "private," member functions of other classes cannot access or modify them which allows members access to these private data.

For a member such as Level, a function like GetLevel() returns the value of the member, while a function like SetLevel() gives it a value.

To learn more about Accessor Function click here:

brainly.com/question/13098886

#SPJ4

5 0
1 year ago
Explain how applying different network topologies could have an impact on the security of a network
nika2105 [10]

Answer:

More open

Explanation:

Hackers could get in easier

4 0
3 years ago
What aspect should you consider before adding pictures to a document? You should structure the first before you search for a rel
suter [353]

Answer:make sure it line up with tour essay

Explanation:

5 0
3 years ago
This type of program is designed to be transmitted over the internet and run in a web browser
vodomira [7]
This sounds like a web-based application because they are designed to be ran within a website, generally with Adobe Flash.
8 0
3 years ago
What are QBASIC Operators ?​
Anna35 [415]

Answer: There are four types of operators in QBASIC. They are Arithmetic Operators, Relational Operators, Logical Operators and Sting Operator. a. Arithmetic Operators. Arithmetic Operators are used to perform mathematical calculations like addition, subtraction, division, multiplication and exponential. :)

5 0
4 years ago
Read 2 more answers
Other questions:
  • Personality traits such as thoughtfulness, empathy, self-control, and goal orientation belong to the _____ category.
    5·2 answers
  • 5. RAM IS YOUR SYSTEM’S-
    14·2 answers
  • A variable of the data type arrays is storing 10 quantities. What is true about these quantities?
    10·1 answer
  • PLS ANSWER ASAP!
    9·1 answer
  • Select the correct answer.
    10·2 answers
  • The birthday problem is as follows: given a group of n people in a room, what is the probability that two or more of them have t
    15·1 answer
  • Does access provide email communication
    13·1 answer
  • John works for Internal Computer Specialists, a company that focuses on helping small business owners resolve MIS infrastructure
    12·1 answer
  • Write a Python program that asks the user for a positive, odd value. Once the value is validated determine if the number is Prim
    11·1 answer
  • Discuss any five factors that hinder the application of a computer in business organisations​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!