Exemple #1
0
  public static void main(String[] args) {

    Coffee caramelMacchiato = new CaramelMacchiato();

    System.out.println("\n-------[caramel macchiato]-------");
    caramelMacchiato.prepareRecipe();
  }
 public static void main(String[] args) {
   Tea tea = new Tea();
   Coffee coffee = new Coffee();
   System.out.println("Making tea...");
   tea.prepareRecipe();
   System.out.println("Making coffee...");
   coffee.prepareRecipe();
 }
 public void setCaffeine(int caffeine) {
   if (caffeine >= 380 && caffeine <= 650) {
     super.setCaffeine(caffeine);
   } else {
     throw new RuntimeException("Invalid value");
   }
 }
  public static void main(String[] args) {

    Tea tea = new Tea();
    Coffee coffee = new Coffee();

    System.out.println("\nMaking tea...");
    tea.prepareRecipe();

    System.out.println("\nMaking coffee...");
    coffee.prepareRecipe();

    TeaWithHook teaHook = new TeaWithHook();
    CoffeeWithHook coffeeHook = new CoffeeWithHook();

    System.out.println("\nMaking tea...");
    teaHook.prepareRecipe();

    System.out.println("\nMaking coffee...");
    coffeeHook.prepareRecipe();
  }
Exemple #5
0
 public static void main(String[] args) {
   Coffee cofeeMaker = new Coffee(Flavors.MOCHA, CupSize.LARGE);
   cofeeMaker.heatWater();
   cofeeMaker.addCream();
   cofeeMaker.stirIt();
   cofeeMaker.addFlavor();
   cofeeMaker.pourIt();
 }
 public int price() {
   return coffee.price() + 2;
 }
Exemple #7
0
 public static void main(String[] args) {
   Tea tea = new Tea();
   Coffee coffee = new Coffee();
   coffee.prepareRecipe();
   tea.prepareRecipe();
 }
 public GroundCoffee(String name, int price, int caffeine, Grinding grinding) {
   super.setName(name);
   super.setPrice(price);
   super.setCaffeine(caffeine);
   this.grinding = grinding;
 }