eos.good
Class Capital

Object
  extended by eos.good.Good
      extended by eos.good.Capital

public class Capital
extends Good

Capital stock

Author:
zhihongx

Field Summary
 
Fields inherited from class eos.good.Good
quantity
 
Constructor Summary
Capital(int quantity, int ownerID, CFirm[] producers)
          Create a new capital stock initialized with quantity of machines.
 
Method Summary
 void add(int qty, double price, int life, CFirm producer)
          Add qty of machines produced by producer, with a per-step price of price and can be used for a maximum of life number of steps
 int decrease(int amount)
          Override, not implemented
 double getPresentValue()
          Return the present value of all machines
 void increase(int amount)
          Override, not implemented
 double useCapital()
          Use the machines.
 
Methods inherited from class eos.good.Good
decrease, getName, getQuantity, increase
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Capital

public Capital(int quantity,
               int ownerID,
               CFirm[] producers)
Create a new capital stock initialized with quantity of machines. Each machine is assigned a random producer from producers. The remaining life of each machine is initialized to a random value between 0.5 * life and life.

Parameters:
quantity - initial quantity of machines
ownerID - ID of the owner
producers - array of all CFirms
Method Detail

increase

public void increase(int amount)
Override, not implemented

Parameters:
amount -

decrease

public int decrease(int amount)
Override, not implemented

Parameters:
amount -
Returns:
0

add

public void add(int qty,
                double price,
                int life,
                CFirm producer)
Add qty of machines produced by producer, with a per-step price of price and can be used for a maximum of life number of steps

Parameters:
qty - quantity of machines to add
price - per-step price of one machine
life - max number of steps the machines could be used for
producer - CFirm that produces these machines

getPresentValue

public double getPresentValue()
Return the present value of all machines

Returns:
the present value of all machines

useCapital

public double useCapital()
Use the machines.

Returns:
number of machines that can no longer be used