public class Property
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static int |
MAX_HOUSE_COUNT |
| Constructor and Description |
|---|
Property(java.lang.String name,
int group,
int baseRent)
Constructs a new Property.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHouse()
Add another house to the Property.
|
boolean |
canBuyHouses()
Check if more houses can be added to the Property.
|
int |
getCost()
Get the cost of this Property.
|
int |
getGroup()
Get the group of the Property.
|
int |
getHouseCost()
Get the cost of purchasing a house for this Property.
|
java.lang.String |
getName()
Get the name of the Property.
|
int |
getNumHouses()
Get the number of houses on the Property
|
Player |
getOwner()
Get the owner of the Property.
|
int |
getRent()
Get the rent for this Property.
|
boolean |
isOwned()
Check if a Property is owned.
|
void |
setOwner(Player owner)
Set the owner of the Property.
|
java.lang.String |
toString()
Create a String representation of this Property.
|
private static final int MAX_HOUSE_COUNT
public Property(java.lang.String name,
int group,
int baseRent)
name - The name of the Propertygroup - The group to which the Property belongsbaseRent - The base rent for the Propertypublic java.lang.String toString()
String should be as follows:
if the property is unowned => "property-name"
otherwise => "property-name (each house costs $house-cost)"
E.g.:
Children's Museum
E.g.:
Children's Museum (each house costs $60)
toString in class java.lang.Objectpublic java.lang.String getName()
public int getGroup()
public int getNumHouses()
public void addHouse()
public boolean canBuyHouses()
public Player getOwner()
public void setOwner(Player owner)
owner - The ownerpublic boolean isOwned()
public int getRent()
Rent is calculated as the base rent + the base rent times the number of houses. E.g., if the rent is $10 and the Property has two houses, rent is $10 + $10*2.
public int getCost()
Cost is calculated as 10 times the base rent for the Property.
public int getHouseCost()
Cost is calculated as 3 times the base rent for the Property.