Input parameter and returns an integer value

Assignment Help Basic Computer Science
Reference no: EM131400949

MethodsArrays

Write a Java program, called MethodsArrays that has 4 static methods called fillArray(), sumArray(), avgArray(), and printArray(). The fillArray() method should be called from the main method. The fillArray() method should use a Scanner to take in a number representing the length of the array and then read in numbers to fill the array.

The sumArray() method should take an int array as its input parameter and returns an integer value that is the sum of all the elements in the array.

The avgArray() method should take an int array as its input parameter and returns an integer value that is the average of all the elements in the array.

The printArray() method should take an int array as its input parameter and has no return value. It should then print out the elements of the array on the same line separated by a space (" "). All methods should work for integer arrays.

Input

n, where n is the length of the array, followed by m numbers

Sample input

3 2 3 4

Output

The program should print to the screen the sum of all the elements in the array, and the average of all the elements in the array followed by the array elements printed to the screen separated by a space.

Sample output

Sum = 9

Average = 3

2 3 4

Note: The Message for sum is: "Sum = " and the message for average is: "Average = "

In your code these should match EXACTLY to pass all test cases.

Reference no: EM131400949

Questions Cloud

Explain the role of the nurse administrator : Explain the role of the nurse administrator as an advanced practice role in nursing.Gather information from current literature, and/or the American Organization of Nurse Executive Competencies, and/or the American Nurses Credentialing Center and ..
Impact of cloud computing to data storage : Write a report on the impact of cloud computing to data storage highlighting its advantages and disadvantages. The report should be APA style and should not exceed 2000 words
Which arguments of different perspectives can be created : Identify a topic of interest for which arguments of different perspectives can be created. Construct one original descriptive argument and one original prescriptive argument for the topic you select.
What type of association would be suggested by large values : What type of association would be suggested by large values of (c, e, g)?- What type of association would be suggested by large values of (a, e, i)?
Input parameter and returns an integer value : The sumArray() method should take an int array as its input parameter and returns an integer value that is the sum of all the elements in the array.
Methods for accessing a remote computer : Write a 200- to 300-word response that discusses the reasons and methods for accessing a remote computer. Must be original, with thought given.
Rationale for choosing the specific firewall in question : Discuss your rationale for choosing the specific firewall in question, and determine the primary way in which a company could incorporate it into an enterprise network in order to enhance security. Select the two (2) most important and / or unique..
Explain online tools for business collaboration : Create an online meeting presentation to evaluate online tools for business collaboration. Create a 10- to 15-slide presentation using a presentation tool. Design the presentation to be used in an online collaboration setting with a group of three..
What you plan to do to improve quality in current position : Quality is an overriding principle in the AACN BSN Essentials document. Essential II specifically describes the role of the baccalaureate nurse in quality improvement. As you complete this course, reflect on how you will implement lessons learned ..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Draw diagrams for each individual wbs element

Integrate diagrams at each level until only one exists. Then begin integration into higher WBS levels until the desired plan is achieved

  Draw the demand and supply curves for the united states

When trade opens, what happens to the quantity of computers produced, and therefore employment, in the computer industry in the United States? In Japan? Who benefits and who loses initially from free trade?

  Finding instruction format for indirect addressing

Determine the instruction format, considering that there is no bit for indirect addressing.

  Is it reasonable to believe the ads may be effective

Polls taken before and after the ad campaign show some increase in the proportion of voters who now recognize this candidate's name, with a P-value of 0.033. Is it reasonable to believe the ads may be effective?

  Recommendations for the next steps the merged company

Create a minimum 12 PowerPoint slides to summarize the policy review conducted and your recommendations for the next steps the merged company should take to protect its data and information assets. The cover, summary/conclusion and reference slides a..

  Define the method called getstringinput( ) using the method

Define the method called getStringInput( ) using the method header

  Compute the least-squares solution

One solution to Ax = b 1s x = [l. 2. 3,4IT Compute the least-squares solution using the SVD, and compare Why was the solution chosen?

  Implement theproperties of a swimming pool

Also addmember functions to do the following: determine the amount of waterneeded to fill an empty or partially filled pool; determine the time neededto completely or partially fill or empty the pool; add or drain water for aspecific amount of tim..

  Can eve pretending to be alice receive a response from bob

Eve, the intruder, sends a user datagram to Bob, the server, using Alice's IP address. Can Eve, pretending to be Alice, receive a response from Bob?

  Implement a loop that prompts a user to enter a number

Sometimes students write programs with instructions such as "Enter data, 0 to quit" and that exit the data entry loop when the user enters the number 0. Explain why that is usually a poor idea.

  Write a function to traverse binary search tree

Give a linear algorithm to compute the chromatic number of graphs where each vertex has degree at most 2. Must such graphs be bipartite?

  Analyze time complexity of multiplying two n-digit number

Analyze the time complexity of multiplying two n-digit numbers with this method as a function of n (assume constant base size). Assume that single-digit by single-digit addition or multiplication takes O(1) time.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd