class EspressoBeverage extends Beverage { EspressoShot shot; public EspressoBeverage(String name, double cost, Size size, Cup cupType) { super(name, cost, size); // use default number of shots int numShots; if ( size==Size.small ) { numShots = 1; } else if ( size==Size.medium ) { numShots = 2; } else if ( size==Size.large ) { numShots = 3; } else { numShots = 0; } shot = new EspressoShot("shots", 0.00, numShots, cupType); } public EspressoBeverage(String name, double cost, Size size, int numShots, Cup cupType) { super(name, cost, size); shot = new EspressoShot("shots", 0.00, numShots, cupType); } }