jfreerails.controller
Class StockPriceCalculator
java.lang.Object
jfreerails.controller.StockPriceCalculator
public class StockPriceCalculator
- extends java.lang.Object
Calculates the stock price for each of the players.
Stock price = [Net worth + 5 * profit last year] / [ shares owned by public +
0.5 shares owned by other players]
Let profit last year = 100,000 in the first year.
- Author:
- Luke
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
w
private final ReadOnlyWorld w
StockPriceCalculator
public StockPriceCalculator(ReadOnlyWorld w)
calculate
public StockPriceCalculator.StockPrice[] calculate()
isFirstYear
boolean isFirstYear(int playerId)
- Returns true if the current time in the same year as the first transaction for the
specified player.
netWorth
long netWorth(int playerId)
- Returns the players networth at the start of this year.
profitsLastYear
long profitsLastYear(int playerId)
sharesOwnedByPublic
int sharesOwnedByPublic(int playerId)
sharesOwnedByOtherPlayers
int sharesOwnedByOtherPlayers(int playerId)
calStockPrice
static Money calStockPrice(long netWorth,
long profitLastyear,
int publicShares,
int otherRRShares)