import java.util.Scanner;

class Oct11 {
	public static void main(String[] args) {

		Scanner kb = new Scanner(System.in);

		System.out.println("Enter in number of test scores");

		int numScores = kb.nextInt();

		int[] scores = new int[numScores];
	
		for(int i = 0; i < numScores; i++) {	
			System.out.println("Please enter in a score");
			scores[i] = kb.nextInt();
		}
		printScores(scores);

		/* compute the average of the scores */

		double sum = 0;
		for(int i = 0; i < numScores; i++) {
			sum += scores[i];   // sum = sum + scores[i];	
		}

		double mean = sum / numScores;
		System.out.println("mean: " + mean);
		
		/*
		 * for-each are useful only when we want to get
		   the values in the array - not set them.
		 */

		sum = 0;
		for(int nextScore : scores) {
			sum += nextScore;
		}

		mean = sum / numScores;
		System.out.println("mean: " + mean);


		String[] names = {"Alice", "Bob"};

		for(String name : names) {
			System.out.println(name);
		}

		int min = findMin(scores);
		System.out.println("min: " + min);

		/* Change every other element in scores to 0 */

		for(int i = 0; i < numScores; i += 2) {
			scores[i] = 0;
		}

		printScores(scores);
		
		// String class has a toCharArray() method.

		String name = names[0];
		char[] chars = name.toCharArray();

		for(int i = 0; i < chars.length; i++) {
			System.out.println(chars[i] + " ");
		}



	}

	/* Write a method named printScores that takes and array of
		integers as an argument and prints the values in the array
		on the same line with spaces between them.
	*/
	static void printScores(int[] scores) {
		for(int i = 0; i < scores.length; i++) {
			System.out.print(scores[i] + " ");
		}
		System.out.println();
	}
		
	/* return the min value in an array of integers */

	static int findMin(int[] arr) {
		if(arr.length == 0) {
			return Integer.MIN_VALUE;
		}
		
		int min = arr[0];
		for(int i = 1; i < arr.length; i++) {
			if(arr[i] < min) {
				min = arr[i];
			}
		}
		return min;	
	}


}

// end of file
