Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Strings Use Arrays Use Methods Some syntax that may help (that you may or may not need): To create an array (of integers for

image text in transcribed
image text in transcribed
Using Strings Use Arrays Use Methods Some syntax that may help (that you may or may not need): To create an array (of integers for example of size 10): int[] arr = new arr[10]; To create an array where you know the values (e.g.,5 ints): int [] arr = {1,2,3,4,5); The length of an array (called arr) is arr.length: You can also look up the String class in java's API (https://docs.oracle.com/javase/9/docs/api/index.html?overview-summary.html] Write a program that has a method called findAverage. The method takes an array of integers. The method then calculates the average of the integers stored in the array and returns the average The method header is: public static double average fine arr) You will test your method in the main method of your program by using a Scanner: . First read in an int(N) representing the length of an array. Use the length to create a new integer array . Read in Nintegers and save these in the array Then call the method findAverage and pass the array you created and print the average that is returned by the method Examples: Samole Outcut the average) Samole Input an int, a sequence of integers) Note: the first number is the size of the array (number of inputs 58 10 271 4 30 20 10 60

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions