//
// You don't need to worry about this code... but if you are curious read on!
//

// Class Interface
//
// If you want to use this class, you look at the class interface to learn how
// to access the members and methods of the class.  Good member/method names
// and pre/post conditions help you figure this out.
//
// This class models any number of six sided dice.  The default is a pair of
// dice.


//
// Class Implementation
//
public class Dice
{
    private int numberOfDice;

 // Precondition: None
 // Postcondition: Default constructor for object, assumes two six sided dice will be rolled
    Dice()
    {
        numberOfDice = 2;
    }
 // Precondition: Value is the number of six-sided dice that you want to roll
 // Postcondition: Creates a dice object with value dice, assumes each die has six sides
    Dice(int value)
    {
        numberOfDice = value;
    }

 // Precondition: None
 // Postcondition: Rolls the dice, returns the sum of the die faces
    public int roll()
    {
        int result=0;

        for(int i = 1; i <= numberOfDice; i++)
        {
            result = result + (int)(Math.random() * 6) + 1;

        }
        
        return result;
    }
    
    public static void main(String[]args)
    {
        Dice dice = new Dice();
        System.out.println(dice.roll());
    }
}


