Monopoly
Class Dice

java.lang.Object
  extended by Monopoly.Dice

public class Dice
extends java.lang.Object

This class represents the dices in the game of Monopoly.
Implementation invariants: the result of the rolling is greater than zero


Constructor Summary
Dice()
           
 
Method Summary
 boolean isDoubles()
          Returns whether doubles were rolled.
 int[] rollDice()
          Rolls the dice.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dice

public Dice()
Method Detail

rollDice

public int[] rollDice()
Rolls the dice.

Pre: true
Post: returns an array with the result of the rolling. It's elements are greater than zero

Returns:
The result of the rolling

isDoubles

public boolean isDoubles()
Returns whether doubles were rolled.

Pre: must follow the rollDice() method call
Post: returns true if rollDice()[0]==rollDice()[1]; else otherwise

Returns:
boolean doubles or not