/** a class to model a coffee maker 
 */
public class CoffeeMaker {
  private CoffeeBrand coffee;
  private int water, cupsBrewed; // default value is 0

  /** drink: decrease cups brewed by number drunk
   */
  public void drink(int cups) {
    cupsBrewed -= cups;
  }


  /** getCoffee: what brand of coffee is in the machine?
   */
  public String getCoffee() {
    return coffee.getName();
  }

  /** freshWater: fill the coffee maker with cups amount of water
   */
  public void freshWater(int cups){
    water= cups;
    cupsBrewed= 0;
  }

  /** brew: brew as much coffee as you have water of coffeeType
   */
  public void brew(String coffeeType) {
    coffee= new CoffeeBrand(coffeeType);
    coffee.brew(water);
    cupsBrewed= water;
    water= 0;
  }

  /** coffeeAvailable: is there cups amount of coffee?
   */
  public boolean coffeeAvailable(int cups) {
    return (cups <= cupsBrewed);
  }

}

