Programming


 

Question: 

Create an array and calculate the numbers as described below.

1) Create an array varibale with size 5
2) Ask user to input elements/values for the array variable
3) Ask user to input a integer number to multiply with array elements that created above. 
4) Pass the array and integer number to a function below (This function should return an integer value)

int calculate(int[], int).

5) Multiply the array elements with that integer number and store the results into new array 
6) Calculate the average value on the new array elements that created in Step-5 and find how many numbers are above average
7) And return this number to main method and display the results. 

Sample Output-1:
Enter 5 numbers to create array elements : 
8
4
5
6
2
Enter the number to multiply with Array elements : 7
Multiplication Results : [56, 28, 35, 42, 14]
Average value is 35.0
2 numbers are above average

Sample Output-2:
Enter 5 numbers to create array elements : 
8
9
4
5
8
Enter the number to multiply with Array elements : 5
Multiplication Results : [40, 45, 20, 25, 40]
Average value is 34.0
3 numbers are above average

Hint: 

You need to use single dimensional array and methods to achieve this task. 

Submission Requirement:

Please you need to submit your work in word format, and  each question should provide the below requirements:

  • The code 
  • The results in screenshots (including minumum 3 test results)