// This class represents a purchase order
class BuyOrder extends Order {
    private String symbol; 
    private int numShares; 
    private double bidPrice; 

    // Construct new BuyOrder object
    public BuyOrder( String symbol, int numShares, double bidPrice) {
        super(); 
        this.symbol = symbol; 
        this.numShares = numShares;
        this.bidPrice = bidPrice;
    }

    // return String that represents this object
    public String toString() {
        return super.toString() + " Buy " + numShares
               + " " + symbol + " @ " + bidPrice; 
    }

    // return true if the current order is valid
    public boolean isGood() {
        return symbol.length() > 0 
             && symbol.indexOf(' ') == -1
             && bidPrice > 0.0
             && numShares > 0 ; 
    } 
}

