Monopoly
Class Taxes

java.lang.Object
  extended by Monopoly.Cell
      extended by Monopoly.Taxes
All Implemented Interfaces:
Interactive

public class Taxes
extends Cell

This class represents the cells which make a player who lands on them to pay a tax.

Implementation invariants: the tax of the Taxes cell is constant during the game

See Also:
Cell, Interactive

Constructor Summary
Taxes(java.lang.String name, int location, int tax)
          Constructs a new Tax cell with specific name location and tax to be paid.
 
Method Summary
 void act(Monopoly game)
          Forces the player to pay a specific amount of money to the bank.
 int getTax()
          Returns the amount of money a player must pay if he lands on the Taxes cell (Accessor).
 
Methods inherited from class Monopoly.Cell
getLocation, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Taxes

public Taxes(java.lang.String name,
             int location,
             int tax)
Constructs a new Tax cell with specific name location and tax to be paid.

Method Detail

getTax

public int getTax()
Returns the amount of money a player must pay if he lands on the Taxes cell (Accessor).

Pre: the tax must be greater than zero
Post: returns the tax which is greater than zero

Returns:
the tax a player must pay (int)

act

public void act(Monopoly game)
Forces the player to pay a specific amount of money to the bank.

Pre: game must be different than null
Post: the player must pay an amount of money to the bank

Specified by:
act in interface Interactive
Overrides:
act in class Cell
Parameters:
game - the Monopoly instance that represents the game.