Monopoly
Class Street

java.lang.Object
  extended by Monopoly.Cell
      extended by Monopoly.Property
          extended by Monopoly.Street
All Implemented Interfaces:
Collectable, Interactive

public class Street
extends Property

This class represents the Street cells on the Monopoly board. The Street cells can be purchaced, a player can build houses and hotels on them, and a visitor pays a rent to the owner of them.

Implementation invariants: the color of the Street cell is constant during the game.

See Also:
Property

Constructor Summary
Street(java.lang.String name, int location, int color, int price, int housePrice, int rent)
          Constructs a new Street cell
 
Method Summary
 int getColor()
          Returns the color of the Street cell (Accessor).
 int getRent()
          Returns the rent to be paid by a player who lands on this street (Accessor).
 int housePrice()
          Returns the price of a house which can be build on the street (Accessor).
 int numOfHouses()
          Returns the number of the Street cell's houses (Accessor).
 
Methods inherited from class Monopoly.Property
act, getOwner, getOwnerName, getPrice, ismortaged, mortage, setOwner, toString, unmortage
 
Methods inherited from class Monopoly.Cell
getLocation, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Street

public Street(java.lang.String name,
              int location,
              int color,
              int price,
              int housePrice,
              int rent)
Constructs a new Street cell

Method Detail

getColor

public int getColor()
Returns the color of the Street cell (Accessor).

Pre: color must be a valid integer
Post: returns the color of the Street cell

Returns:
The color of the Street cell (int)

numOfHouses

public int numOfHouses()
Returns the number of the Street cell's houses (Accessor).

Pre: the number of houses must be zero or greater than zero.
Post: returns the number of houses which must be zero or greater than zero.

Returns:
The number of the Street cell's houses (int)

getRent

public int getRent()
Returns the rent to be paid by a player who lands on this street (Accessor).

Pre: true
Post: The returned rent is different than the default regarding some parameters

Specified by:
getRent in class Property
Returns:
The rent of the street (int)

housePrice

public int housePrice()
Returns the price of a house which can be build on the street (Accessor).

Pre: true
Post: Returns a standar price for each street

Returns:
The price of the house (int)