/**
 * ArrayPlay contains some methods to work with Arrays
 * It has been intentionally kept simple to explore Eclipse
 * 
 * @author Nancy Harris
 * @version V1 - Jan/2013
 */
public class ArrayPlay
{
    /**
     * sum - sums the values in an array
     * 
     * @param iArray The array to sum
     * @return The sum of the values in the array
     */
    public int sum(int [] iArray)
    {
        int sum = 0;
        
        for (int num : iArray)
            sum += num;
        return sum;
    }
    
    /** countRolls counts the rolls of a Die object
     *  returning an array of 6 elements each representing
     *  the count of that number.
     *  So the 0th position of the array will count the 
     *  number of times that 1 is rolled and 5th position
     *  will count the number of times that 6 is rolled
     *  
     * @param die The Die object we want to test
     * @return An array with the corresponding counts
     */
    public int[] countRolls(Die die)
    {
        int [] counts = new int[6];
        
        for (int ii = 1; ii <= 10; ii++)
        {
            counts[die.roll() - 1]++;
        }
        
        return counts;
    }
    
}
