Skip to content

Instantly share code, notes, and snippets.

@HDBandit
Last active May 14, 2016 17:10
Show Gist options
  • Save HDBandit/6ee4f2db92c2535434af153e885275a1 to your computer and use it in GitHub Desktop.
Save HDBandit/6ee4f2db92c2535434af153e885275a1 to your computer and use it in GitHub Desktop.
// The client orders a Barbacoa pizza. The base price of the pizza is 15 dollars.
Pizza myOrder = Pizza.newPizza(15, baicon(), cheese(), tomato(), barbacoaSauce());
// The client adds some complements
// We are decorating the pizza with complements
myOrder.setComplements(
Complements::chips,
Complements::extraDrink,
Complements::iceCream,
Complements::cinemaDisccount);
// Finally get the price
System.out.println("Base price of the barbacoa pizza: " + myOrder.getBasePrice());
System.out.println("Total price to pay with the complements: " + myOrder.getTotalPrice());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment