/**
 * Represents the values of five dice named a, b, c, d, e.
 *
 * @author Chris Mayfield
 * @version 02/08/2017
 */
public class Dice {
    
    /** The first die. */
    private final int a;
    
    /** The second die. */
    private final int b;
    
    /** The third die. */
    private final int c;
    
    /** The fourth die. */
    private final int d;
    
    /** The fifth die. */
    private final int e;
    
    /**
     * Constructs a new Dice object with the given face values.
     *
     * @param die1 value of first die
     * @param die2 value of second die
     * @param die3 value of third die
     * @param die4 value of fourth die
     * @param die5 value of fifth die
     */
    public Dice(int die1, int die2, int die3, int die4, int die5) {
        this.a = die1;
        this.b = die2;
        this.c = die3;
        this.d = die4;
        this.e = die5;
    }
    
    /**
     * Adds the values of all dice together.
     *
     * @return sum total of all dice values
     */
    public int addValues() {
        return this.a + this.b + this.c + this.d + this.e;
    }
    
    /**
     * Counts how many dice have the given face value.
     *
     * @param face value to look for (1 to 6)
     * @return number of dice that match (0 to 5)
     */
    public int countValues(int face) {
        int count;
        count = 0;
        if (this.a == face) {
            count = count + 1;
        }
        if (this.b == face) {
            count = count + 1;
        }
        if (this.c == face) {
            count = count + 1;
        }
        if (this.d == face) {
            count = count + 1;
        }
        if (this.e == face) {
            count = count + 1;
        }
        return count;
    }
    
}
