Question
Can anyone solve this java script method question please? 1.Write a method called getNumbers that takes no parameters and returns an array of integers. In
Can anyone solve this java script method question please?
1.Write a method called getNumbers that takes no parameters and returns an array of integers. In the method, write a loop to allow the user to enter as many integers as they like. Store these in an array called numArray and return the array when the user is done.
2.Write a method called calcAverage that takes an array of integers as a parameter and returns a double. Compute the average of the integers in the array that is passed and return this value.
3.
Call both methods above from the main method. The pseudocode for the main method is as given below. Then print the average with a statement "The average of the numbers is: X" where X is the average you calculated. (4 points)
Get the numbers from the user Compute the average Print the average to the command line.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started