//khalil
package src;

public abstract class Property extends BoardLocation
{
    protected final int cost;						// the cost of property
    protected Player owner;					// who owns the  property
    //protected int rent;						// how much rent the person who lends pays

    public Property(String name, int address, int cost)
    {
    	super(name,address);
        this.cost = cost;
        this.owner = null;
    }
    
    public abstract void collectRent(Player player);

    public int getCost()
    {
        return cost;
    }

    public Player getOwner()
    {
        return owner;
    }

    public void setOwner(Player owner)
    {
        this.owner = owner;
    }

    public boolean isOwned()
    {
        return owner != null;
    }
    
    @Override
    public String toString()
    {
    	String player;
    	
    	player = owner == null ? "no one" : owner.getToken();
    	return super.toString() + " Cost $" + cost + ". Owned by " + player + ".";
    }
    
 
}
@@ -319,22 +319,234 @@
 t cost)%0A
+    // PRE: name, address, and cost is initialized 0 %3C= address %3C= 39, cost %3E= 0  %0A%09// POST: creates a Property object with name set to name, address set to address%0A    //%09cost set to cost and owner set to owner%0A
     %7B%0A
-
     %09sup
@@ -706,16 +706,119 @@
 tCost()%0A
+    // PRE: cost and player is initialized  %0A%09// POST: FCTVAL: returns the cost to collect from player%0A
     %7B%0A  
@@ -872,16 +872,68 @@
 Owner()%0A
+    // PRE: player is initalized%0A%09// POST: FCTVAL: %0A
     %7B%0A  
@@ -998,16 +998,45 @@
  owner)%0A
+    // PRE:%0A%09// POST:FCTVAL:%0A
     %7B%0A  
@@ -1097,16 +1097,45 @@
 Owned()%0A
+    // PRE:%0A%09// POST:FCTVAL:%0A
     %7B%0A  
@@ -1216,16 +1216,45 @@
 tring()%0A
+    // PRE:%0A%09// POST:FCTVAL:%0A
     %7B%0A  
@@ -1420,18 +1420,11 @@
 .%22;%0A
+
     %7D%0A
-    %0A %0A
 %7D

add comments