Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me to a program that will prompt the user for a list of 5 prices. On

ID: 3623483 • Letter: P

Question

Please help me to a program that will prompt the user for a list of 5 prices. Once the user has entered all values, your program should compute and display the following:

The sum of all the prices

The average of the prices

All prices that are higher than the calculated average



To better solve this problem, break your code out into the following methods:

sumArray – this method should receive an array and return the sum of all elements in the array. NOTE: this method produces no output.

aveArray – this method should receive an array and return the average of all elements in the array. NOTE: this method produces no output.

highPrices – this method should receive an array and an average. It should then print out all elements in the array whose values are greater than the average.



When you are finished writing these methods, create a main method that will prompt the user for the 5 prices and then call the appropriate methods.

Be sure your program demonstrates good programming style (appropriate comments, identifier names, indenting, etc).
Be sure your program demonstrates good programming style (appropriate comments, identifier names, indenting, etc).

Although my output is not required to look this way, it might look something like:

Please enter a value: 1.23

Please enter a value: 2.34

Please enter a value: 3.45

Please enter a value: 4.56

Please enter a value: 5.00



The sum of these values is $16.58

The average of these values is: $3.32

The values higher than the average are:

$3.45

$4.56

$5.67

NOTE: The dollar signs ($) and output formatted to two decimal places are not required for this exercise, but do make the output nicer. You should try to do this if you have time.


Explanation / Answer

import java.util.Scanner; import java.text.DecimalFormat; public class Calculator { public static float sumArray(float[] array) { float sum=0; for(int i=0; i