//Encapsulates the behavior of a security trading on a particular //segment of the exchange package fauxExchange; class Security { public Security (int id){ this.securityId = id; } public Security (int id, String symbol){ this.securityId = id; this.symbol = symbol; } public Security (int id, String symbol, Segment seg){ this.securityId = id; this.symbol = symbol; this.segment = seg; } public Security (int id, Segment seg){ this.securityId = id; this.segment = seg; } public Security () {} private Segment segment; private String symbol; private double lastPrice; private int securityId; public String getSymbol(){ return this.symbol; } public String toString(){ if (symbol != null){ return symbol; }else{ return Integer.toString(securityId); } } /** * @return (double) LastPrice :: Returns the last price */ public double getLastPrice(){ return this.lastPrice; } public void setSymbol(String s){ this.symbol = s; } public void setLastPrice(double pr){ this.lastPrice = pr; } public Segment getSegment() { return this.segment; } public void setSegment(Segment s){ this.segment = s; } public int getSecurityId(){ return this.securityId; } } //end class