eolymp
bolt
Try our new interface for solving problems
Problems

Java Abstract Array Sum Average

Java Abstract Array Sum Average

Implement abstract class Arr.

Implement class Array that extends Arr.

abstract class Arr
{
  int a[]; // array of integers
  int n; // size of array
  abstract int Sum(); // Return sum of array elements
  abstract double Average(); // Return average of array elements
}

class Array extends Arr
{
  Array (int n) // Constructor
  int Sum() // Return sum of array elements
  double Average() // Return average of array elements
}

Input

First line contains number n. Next line contains n integers in the range from 0 to 100.

Output

Print in one line the sum of array elements and their average.

Time limit 1 second
Memory limit 128 MiB
Input example #1
5
3 6 8 2 4
Output example #1
23 4.6
Author Михаил Медведев