import java.util.Scanner;

class Mar9 {

	public static void main(String[] args) {

		int[] arr = new int[10];
		setArray(arr);
		printArray(arr);	

		int result = sumArray(arr);
		System.out.println("sum: " + result);

		double value = computeMean(arr);
		System.out.println("mean: " + value);	

	}

	/* write a method named setArray that takes an 
	   array of integers 
	   as an argument and populates the array with 
 	   values supplied by the user */
 
	static void setArray(int[] arr) {
		int len = arr.length;

		Scanner kb = new Scanner(System.in);
		System.out.printf("Please enter %d integers separated by spaces\n", len);
		for(int i = 0; i < len; i++) {
			int value = kb.nextInt();
			arr[i] = value;
		}

		kb.close();
	}

	/* Write a method named printArray that takes an array of integers
	   as an argument and prints the contents of the array to the screen */

	static void printArray(int[] arr) {
		for(int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
	}

	/* Write a method named sumArray that takes an array of integers
	   as an argument and returns the sum of the values in the array */

	static int sumArray(int[] arr) {
		int sum =0;

		for(int i = 0; i < arr.length; i++) {
			sum = arr[i] + sum;
		}
		return sum;
	}
	
	/* Write a method named computeMean that takes an array of integers
	   as an argument and returns the mean average of the elements in
	   the array */

	static double computeMean(int[] arr) {
		return sumArray(arr) / (double)arr.length;
	}

}

