Model for stock trading example

The StockPriceChangeEvent class contains the ticker of the stock, the old price of the stock, and the new prices of the stock:

    public class StockPriceChangeEvent {
private final String stockTicker;
private final BigDecimal oldPrice;
private final BigDecimal newPrice;
//Setter, Getters and toString()
}

The StockPriceChangeEventWithHoldings class extends StockPriceChangeEvent. It has one additional property--holdings. The holdings variable is used to store the number of stocks the trader currently owns:

    public class StockPriceChangeEventWithHoldings 
extends StockPriceChangeEvent {
private Integer holdings;
//Setter, Getters and toString()
}

The StockTicker enum stores list of stocks that the application supports:

    public enum StockTicker {
GOOGLE, FACEBOOK, TWITTER, IBM, MICROSOFT
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset