Skip to content

Instantly share code, notes, and snippets.

@enseitankad0
Created February 28, 2018 22:48
Show Gist options
  • Save enseitankad0/237f34510b87c2e4eb20b08cc2429795 to your computer and use it in GitHub Desktop.
Save enseitankad0/237f34510b87c2e4eb20b08cc2429795 to your computer and use it in GitHub Desktop.
package com.kamilszufnara;
public class Main {
public static void main(String[] args) {
// creating normal burger
System.out.println("----Standard Burger ---");
Burger burger = new Burger("Standard burger", 5, "pork", "white bread");
burger.addAddition1("tomato", 2);
burger.addAddition2("lettuce", 3);
burger.addAddition3("potato",4);
System.out.println("Total price: " +burger.paragonBurger());
// creating HealthyBurger
System.out.println("---Healthy Burger---");
HealthyBurger healthyBurger = new HealthyBurger(8,"duck");
healthyBurger.addHealthyAddition1("Zuccini",3);
healthyBurger.addAddition1("egg",4);
healthyBurger.addHealthyAddition2("Cucumber",1);
System.out.println("Total price: " + healthyBurger.paragonBurger());
// creating deluxeBurger
System.out.println("Creating Deluxe Hamburger");
DeluxeBurger deluxeBurger = new DeluxeBurger();
System.out.println("Total price: " + deluxeBurger.paragonBurger());
deluxeBurger.addAddition1("it will not work",222);
// proof
System.out.println("Proof -> Total price: " + deluxeBurger.paragonBurger());
// healthyBurger.addHealthyAddition1("Zuccini",3);
//healthyBurger.paragonBurger();
}
}
// The purpose of the application is to help a fictitious company called Bills Burgers to manage
// their process of selling hamburgers.
// Our application will help Bill to select types of burgers, some of the additional items (additions) to
// be added to the burgers and pricing.
// We want to create a base hamburger, but also two other types of hamburgers that are popular ones in Bills store.
// The basic hamburger should have the following items.
// Bread roll type, meat and up to 4 additional additions (things like lettuce, tomato, carrot, etc) that
// the customer can select to be added to the burger.
// Each one of these items gets charged an additional price so you need some way to track how many items got added
// and to calculate the final price (base burger with all the additions).
// This burger has a base price and the additions are all separately priced (up to 4 additions, see above).
// Create a Hamburger class to deal with all the above.
// The constructor should only include the roll type, meat and price, can also include name of burger or you
// can use a setter.
// Also create two extra varieties of Hamburgers (subclasses) to cater for
// a) Healthy burger (on a brown rye bread roll), plus two addition items that can be added.
// The healthy burger can have 6 items (Additions) in total.
// hint: you probably want to process the two additional items in this new class (subclass of Hamburger),
// not the base class (Hamburger), since the two additions are only appropriate for this new class
// (in other words new burger type).
// b) Deluxe hamburger - comes with chips and drinks as additions, but no extra additions are allowed.
// hint: You have to find a way to automatically add these new additions at the time the deluxe burger
// object is created, and then prevent other additions being made.
// All 3 classes should have a method that can be called anytime to show the base price of the hamburger
// plus all additionals, each showing the addition name, and addition price, and a grand/final total for the
// burger (base price + all additions)
// For the two additional classes this may require you to be looking at the base class for pricing and then
// adding totals to final price.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment