Write a method, including the method header, that will receive an array of integers and will return the average of all the integers. Be sure to use the return statement as the last statement in the method. A method that receives an array as a parameter should define the data type and the name of the array with brackets, but not indicate the size of the array in the parameter. A method that returns the average value should have double as the return type, and not void. For example: public static returnType methodName(dataType arrayName[]) 3 The array being passed as a parameter to the method will have 10 integer numbers, ranging from 1 to 50. The average, avgNum, should be both printed in the method, and then returned by the method. To print a double with 2 decimal points precision, so use the following code to format the output: System.out.printf("The average of all 10 numbers is %.2f\n", avgNum);

Answers

Answer 1

Answer:

The method is as follows:

public static double average(int [] arrs){

    double sum = 0,avgNum;

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

        sum+=arrs[i];

    }

    avgNum = sum/arrs.length;

    System.out.printf("The average of all numbers is %.2f\n", avgNum);

    return avgNum;

}

Explanation:

This defines the method

public static double average(int [] arrs){

This declares sum and avgNum as double; sum is then initialized to 0

    double sum = 0,avgNum;

This iterates through the array

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

This adds up the array elements

        sum+=arrs[i];     }

This calculates the average

    avgNum = sum/arrs.length;

This prints the average to 2 decimal places

    System.out.printf("The average of all numbers is %.2f\n",

avgNum);

This returns the average to main

    return avgNum; }


Related Questions

Which term refers to the use of expressions to check consistency in relation to other fields in the same record?
O data validation
O record validation
O input mask
O validation text

Answers

This is the answer 3 due to the thought me

The  term validation text refers to the use of expressions to check consistency in relation to other fields in the same record.

What is the use of validation text?

The term Validation text is known to be one that helps a user to be able to have a message that can help them to be able to input data that is said to be not valid.

Conclusively, Validations rules is known to aid one in that one can check data for accuracy and consistency in terms of  data entry.

Learn more about Validation text from

https://brainly.com/question/12069810

#SPJ2

DESCRIBE THE GENERAL STRATEGY BEHIND DEALOCK PREVENTION AND GIVE A PRATICAL EXAMPLE

Answers

Answer:

........

Explanation:..........

Why use LinkedIn automation for LinkedIn?

Answers

Answer:

Using LinkedIn automation tools to run successful outreach campaigns has become popular. It’s because these tools automate tedious networking tasks such as visiting profiles, collecting data, sending out bulk connection requests, messages, and follow-ups, etc.  

With the help of the latest LinkedIn automation tools, you can quickly perform all the repetitive tasks while saving yourself a lot of time that you can use on actual relationship building and lead nurturing tasks.  

However, LinkedIn isn’t really amused when using any bots or automation tools for LinkedIn.

Question No: 9 Of 50 Time Left : 59:18
ОА
QUESTION
Which of the following two entities (reading from Left to right) can be connected by the dot operator?
A class member and a class object.
A class object and a class,
A constructor and a member of that class.
OB
Ос
OD
A class object and a member of that class.

Answers

Answer:b

Explanation:

to get points

Help Pls
I need about 5 advantages of E-learning​

Answers

Answer:

Explanation:

E-learning saves time and money. With online learning, your learners can access content anywhere and anytime. ...

E-learning leads to better retention. ...

E-learning is consistent. ...

E-learning is scalable. ...

E-learning offers personalization.

Answer:

E- learning saves time and money

E-learning makes work easier and faster

E- learning is convenient

E- learning is consistent

E- learning is scalable

Explanation:

when you learn using the internet, you save a lot of time by just typing and not searching through books

The advantage of returning a structure type from a function when compared to returning a fundamental type is that a. the function can return multiple values b. the function can return an object c. the function doesn’t need to include a return statement d. all of the above e. a and b only

Answers

Answer:

The advantage of returning a structure type from a function when compared to returning a fundamental type is that

e. a and b only.

Explanation:

One advantage of returning a structure type from a function vis-a-vis returning a fundamental type is that the function can return multiple values.  The second advantage is that the function can return can an object.  This implies that a function in a structure type can be passed from one function to another.

An organization needs to integrate with a third-party cloud application. The organization has 15000 users and does not want to allow the cloud provider to query its LDAP authentication server directly. Which of the following is the BEST way for the organization to integrate with the cloud application?

a. Upload a separate list of users and passwords with a batch import.
b. Distribute hardware tokens to the users for authentication to the cloud
c. Implement SAML with the organization's server acting as the identity provider.
d. Configure a RADIUS federation between the organization and the cloud provider

Answers

Answer:

The BEST way for the organization to integrate with the cloud application is:

c. Implement SAML with the organization's server acting as the identity provider.

Explanation:

Implementing SAML (Security Assertion Markup Language) integrations will provide more security to the organization (identity provider) as users' credentials are exposed to fewer parties.  SAML authenticates the users to the cloud application provider.  SAML enables the organization to pass authorization credentials to the service provider by transferring the users' identities to the service provider.

Other Questions
solve for x. solve for x. solve for x. A health club sold ten memberships in one week for total of $3000. If male memberships cost $300 and female memberships cost $300, then how many male memberships and how female memberships were sold? What information does the first quantum number of an electron give? A. The sublevel that the electron is in B. The specific orbital the electron is in C. The energy level the electron is in D. The spin that the specific electron has m% of a number equals n. can you find the number? is solicitation with the promise of reward is the highest level of sexual harassment Gary Tuttle has Citiwide Insurance with 100% coverage after a $25.00 copay on office visits. His services today include an office visit ($62.00), urinalysis with differential ($65.00) and a Treadmill ECG ($155.00), which were billed to his insurance company. The insurance approved/allowed $255.00 and paid 100% of the approved/allowed amount minus the copay already paid by the patient; answer the following: 11. How much is the copay? __________________________ 12. How much is adjusted? __________________________ 13. How much is the payment from the insurance company? ___________________________ A normal distribution has a mean of 15 and a standard deviation of 2. Find the value that corresponds to the 75thpercentile. Round your answer to two decimal places.N0.000.010.020.030.040.050.060.070.080.090.50.69150.69500.69850.70190.70540.70880.71230.71570.71900.72240.6 0.72570.72910.73240.73570.7389 0.74220.74540.74860.75170.75490.7 0.75800.76110.76420.76730.77040.77340.77640.77940.78230.78520.80.78810.79100.79390.79670.79950.80230.80510.80780.81060.8133 which two ocean border south america Why is the value of -9 is not-3 39 POINTSAncient Mesopotamia was a river valley civilization. It was located on the banks of the Tigris and Euphrates Rivers. The Mesopotamians were skilled hunters, but they primarily relied on agriculture for sustenance. The rivers helped them with their agricultural activities.The ancient Mesopotamians mainly depended on ____ for food. When Jonathan runs the 400 meter dash, his finishing times are normally distributed with a mean of 88 seconds and a standard deviation of 2.5 seconds. If Jonathan were to run 48 practice trials of the 400 meter dash, how many of those trials would be between 89 and 91 seconds, to the nearest whole number? A rectangular drawing is enlarged by 30%. The original dimensions of this drawing are 16cm x 24cm.Determine the scale factor, as a fraction that represents this enlargement. What are the new, enlargeddimensions? Complete combustion of a 0.350 g sample of a compound in a bomb calorimeter releases 14.0 kJ of heat. The bombcalorimeter has a mass of 1.20 kg and a specific heat of 3.55 J/(g;C).If the initial temperature of the calorimeter is 22.5C, what is its final temperature?Use 0= mCOAT Consider the terms elements, compounds, and mixtures. What do you think each ofthese is? what is the value of sum of 18 and 3 time the difference of 9 and 5 divided by 2 is subtracted from 30 ? if u give right answer i will mark u as a brainlist The USDA dietary guidelines recommend that individuals obtain approximately 0.80 grams of protein for each kilogram of body weight. This number should also fall between 10 and 35 percent of total daily calories. Jose weighs 152 pounds, which is a healthy weight for his height. He consumes about 2,200 calories a day. According to these USDA guidelines for daily protein intake, approximately how many grams of protein should Jose consume every day What is the length of de? Modern plant-breeding techniques (artificial selection in action) have reduced genetic variability in many of our most commercially valuable plants. To most people, that would generate a shrug. However, a biology student that has studied evolution understands the problem with this. Briefly explain why there is an issue with this. Help with step by step solution please Categorize the trigonometric functions as positive or negative.