...

Write code to find the minimum, maximum, count, total and average of the integer elements in the input array.

Input (Integer Array) Output
{ 52, 34, 5, 78, 210, 76, 21 } Min = 5
Max = 210
Count (Number of Elements) = 7
Total = 52 + 34 + 5 + 78 + 210 + 76 + 21 = 476
Average = Total / Count = 476 / 7 = 68
{ 54, -36, 3, 74, -210, 176, 421, 0, 94 } Min = -210
Max = 421
Count (Number of Elements) = 9
Total = 54 + -36 + 3 + 74 + -210 + 176 + 421 + 0 + 94 = 576
Average = Total / Count = 576 / 9 = 64

class CalculateStatistics

{    public static void main(String s[])
{
int input[] = { 52, 34, 5, 78, 210, 76, 21 };
Statistics result = calculateStatistics(input);

System.out.println("Min = " + result.minimum);
System.out.println("Max = " + result.maximum);
System.out.println("Count = " + result.count);
System.out.println("Total = " + result.total);
System.out.println("Average = " + result.average);

}

public static Statistics calculateStatistics(int[] input)
{
//Write code here to create a new Statistics object and assign minimum, maximum and average values to it.
}
}
class Statistics
{
int minimum;
int maximum;
int count;
int total;
int average;
}
0
Wrong
Score more than 2 points