Ejemplo n.º 1
0
 public Pizza createPizza(String style, String type) {
   Pizza pizza = null;
   if (style.equals("NY")) {
     if (type.equals("cheese")) {
       pizza = new NYStyleCheesePizza();
     } else if (type.equals("veggie")) {
       pizza = new NYStyleVeggiePizza();
     } else if (type.equals("clam")) {
       pizza = new NYStyleClamPizza();
     } else if (type.equals("pepperoni")) {
       pizza = new NYStylePepperoniPizza();
     }
   } else if (style.equals("Chicago")) {
     if (type.equals("cheese")) {
       pizza = new ChicagoStyleCheesePizza();
     } else if (type.equals("veggie")) {
       pizza = new ChicagoStyleVeggiePizza();
     } else if (type.equals("clam")) {
       pizza = new ChicagoStyleClamPizza();
     } else if (type.equals("pepperoni")) {
       pizza = new ChicagoStylePepperoniPizza();
     }
   } else {
     System.out.println("Error: invalid type of pizza");
     return null;
   }
   pizza.prepare();
   pizza.bake();
   pizza.cut();
   pizza.box();
   return pizza;
 }
Ejemplo n.º 2
0
 public Pizza prderPizza(String type) {
   Pizza pizza;
   pizza = createPizza(type);
   pizza.prepare();
   pizza.bake();
   pizza.box();
   pizza.cut();
   return pizza;
 }
Ejemplo n.º 3
0
  Pizza order(String type) {

    pizza = factory.createPizza(type);
    pizza.prepare();
    pizza.bake();
    pizza.cut();
    pizza.box();
    return pizza;
  }
Ejemplo n.º 4
0
 public Pizza orderPizza(String type) {
   Pizza pizza = createPizza(type);
   System.out.println("--- Making a " + pizza.getName() + " ---");
   pizza.prepare();
   pizza.bake();
   pizza.cut();
   pizza.box();
   return pizza;
 }
Ejemplo n.º 5
0
 Pizza orderPizza(String pizzaType, String orderedBy) {
   Pizza pizza = factory.createPizza(pizzaType);
   pizza.setOwner(orderedBy);
   pizza.prepare();
   pizza.bake();
   pizza.cut();
   pizza.box();
   return pizza;
 }