Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;
- import java.util.Scanner;
- public class Burger {
- public static Scanner scanner=new Scanner(System.in);
- int price;
- Meat meat_type;
- Bread bread;
- Additions additions;
- public Burger( Meat meat_type, Bread bread, Additions additions) {
- setPrice(17);
- this.meat_type = meat_type;
- this.bread = bread;
- this.additions = additions;
- }
- public Burger() {
- }
- public void setAdditions(Additions additions) {
- this.additions = additions;
- }
- public void setPrice(int price) {
- this.price = price;
- }
- public int getPrice() {
- return price;
- }
- public Meat getMeat_type() {
- return meat_type;
- }
- public Bread getBread() {
- return bread;
- }
- public Additions getAdditions() {
- return additions;
- }
- public Additions add_additions() {
- Additions burger_addition= new Additions(false,false,false,false,false,false,false,false);
- System.out.println("please enter how many 0 to stop adding");
- int input =-1 ;
- while (input != 0) {
- System.out.println("Please enter what additions you want to put keep in mind it will cost you extra dollar for each\n" +
- "1.drink\n" +
- "2.letters\n" +
- "3.tommato\n" +
- "4.caret\n" +
- "5.bbq_souce\n" +
- "6.tommato_souce\n" +
- "7.extra_meat\n" +
- "8.chips");
- input = scanner.nextInt();
- switch (input) {
- case 0:
- return burger_addition;
- case 1:
- burger_addition.setDrink(true);
- this.price +=2;
- break;
- case 2:
- burger_addition.setLetters(true);
- this.price +=2;
- break;
- case 3:
- burger_addition.setTommato(true);
- this.price +=2;
- break;
- case 4:
- burger_addition.setCaret(true);
- this.price +=2;
- break;
- case 5:
- burger_addition.setBbq_souce(true);
- this.price +=2;
- break;
- case 6:
- burger_addition.setExtra_meat(true);
- this.price +=2;
- break;
- case 7:
- burger_addition.setChips(true);
- price +=2;
- break;
- default: {
- System.out.println("wrong Input");
- break;
- }
- }
- }
- return burger_addition;}
- public Bread add_bread_type(){
- System.out.println("Please Enter the type of of bread: ");
- String bread_type_input=scanner.nextLine();
- System.out.println("Please enter the size of bread Large,small...: ");
- String bread_size_input=scanner.nextLine();
- Bread bread_type=new Bread(bread_type_input,bread_size_input);
- return bread_type;
- }
- public Meat add_meat_type(){
- System.out.println("Please Enter the type of meat: ");
- String meat_type_input=scanner.nextLine();
- System.out.println("Please enter the size of meat Large,small...: ");
- String meat_size_input=scanner.nextLine();
- Meat meat_type=new Meat(meat_type_input,meat_size_input);
- return meat_type;
- }
- public Burger add_burger(){
- Burger burger=new Burger(add_meat_type(),add_bread_type(),add_additions());
- return burger;
- }
- public static String printAdditions(Additions additions){
- String additions_value="";
- if(additions.drink==true){
- additions_value ="Drink";
- }
- if(additions.chips==true){
- additions_value="Chips";
- }
- if(additions.tommato==true){
- additions_value="tommato";
- }
- if(additions.bbq_souce==true){
- additions_value="BBQ Souce";
- return additions_value;
- }
- if(additions.letters==true){
- additions_value="Latters";
- }
- if(additions.caret==true){
- additions_value="Carets";
- }
- if(additions.tommato_souce==true){
- additions_value="Tommato souce";
- }
- return additions_value;
- }
- public static void printBriger(Burger burger){
- System.out.println("The price is "+ burger.getPrice()+" for this burger");
- System.out.println("The additions are " + printAdditions(burger.getAdditions()));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement