package jp.co.jid.collectionSample;

import java.util.HashMap;

public class GradesData01 {

	public static void main(String[] args) {
		// 01の解答
		System.out.println("-- 【演習⑨】01 --");
		HashMap<String, Integer> map = new HashMap<String, Integer>();
		Data01 data01 = new Data01();
		String[] nameArray = data01.getNames();
		int[] pointArray = data01.getPoints();
		for (int i = 0; i < nameArray.length; i++) {
			map.put(nameArray[i], Integer.valueOf(pointArray[i]));
		}
		for (String name : map.keySet()) {
			System.out.println(name + " : " + map.get(name));
		}

		// 02の解答
		System.out.println("-- 【演習⑨】02 --");
		int sum = 0;
		double avg = 0;
		for (Integer point : map.values()) {
			sum += point.intValue();
		}
		avg = (double)sum / map.size();
		System.out.println("合計得点は" + sum);
		System.out.println("平均得点は" + avg);
	}

}
