Question

PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an order at a fast-food burger joint. This cNane sting Type: Sting O package anerae gemer and seter Genarate geter Genrate se Cenerate jvadec Peview private String strinNotice that the code Netbeans is going to automatically generate for you is shown in the Preview window. Make sure your dialo

15) Finally, add a toString ) method to your class. This method is something that you usually add to a new class that specifiNow, run your program to see the information about each new BurgerOrder get printed out Output-LabsTestProject (run) BurgerOrPREV CLAB8 NEXT CLASS MMARY: NESTED FIELD CONSTRI VETHOO DETAIL FIELDICONSTRIMETHOO Class BurgerOrder extende ijavs lang.obje5) Create a constructor for FastFoodKitchen that populates orderList with an initial set of three orders using the same numbePart C: Add a method that will cancel a specific order (1 point) 1) Add the following method to FastFoodKitchen. public boole

Additional code needed:

FastFoodKitchen kitchen new FastFoodKitchen Scanner sc new Scanner(System. in); while (kitchen.get Wsee if user wants to add

0 0
Add a comment Improve this question Transcribed image text
Answer #1

BurgerOrder class

package ques4;

public class BurgerOrder {
   private int numCheeseburgers=0;
   private int numHamburgers=0;
   private int numVeggieburgers=0;
   private int numSodas=0;
   private boolean orderTOGO=false;
   private int orderNum=123;
   //Constructor
   public BurgerOrder(int numCheeseburgers, int numHamburgers, int numVeggieburgers, int numSodas, boolean orderTOGO,
           int orderNum) {
       super();
       this.numCheeseburgers = numCheeseburgers;
       this.numHamburgers = numHamburgers;
       this.numVeggieburgers = numVeggieburgers;
       this.numSodas = numSodas;
       this.orderTOGO = orderTOGO;
       this.orderNum = orderNum;
   }
   //below are getter and setters
   public int getNumCheeseburgers() {
       return numCheeseburgers;
   }
   public void setNumCheeseburgers(int numCheeseburgers) {
       this.numCheeseburgers = numCheeseburgers;
   }
   public int getNumHamburgers() {
       return numHamburgers;
   }
   public void setNumHamburgers(int numHamburgers) {
       this.numHamburgers = numHamburgers;
   }
   public int getNumVeggieburgers() {
       return numVeggieburgers;
   }
   public void setNumVeggieburgers(int numVeggieburgers) {
       this.numVeggieburgers = numVeggieburgers;
   }
   public int getNumSodas() {
       return numSodas;
   }
   public void setNumSodas(int numSodas) {
       this.numSodas = numSodas;
   }
   public boolean isOrderTOGO() {
       return orderTOGO;
   }
   public void setOrderTOGO(boolean orderTOGO) {
       this.orderTOGO = orderTOGO;
   }
   public int getOrderNum() {
       return orderNum;
   }
   public void setOrderNum(int orderNum) {
       this.orderNum = orderNum;
   }
   // toString() method to print the object
   @Override
   public String toString() {
       return "BurgerOrder [numCheeseburgers=" + numCheeseburgers + ", numHamburgers=" + numHamburgers
               + ", numVeggieburgers=" + numVeggieburgers + ", numSodas=" + numSodas + ", orderTOGO=" + orderTOGO
               + ", orderNum=" + orderNum + "]";
   }
   public static void main(String[] args)
   {
       BurgerOrder order1= new BurgerOrder(3, 5, 4, 10, false, 1);
       BurgerOrder order2= new BurgerOrder(0, 0, 3, 2, true, 2);
       BurgerOrder order3= new BurgerOrder(1, 1, 0, 2, false, 3);
       System.out.println(order1);
       System.out.println(order2);
       System.out.println(order3);
       order1.setNumSodas(12);
       //After changing soda count
       System.out.println(order1);
   }
  

}

urgerorder [numCheeseburgersz, numhamburgers-5, numVeggiebungers-4, numSodas-10, orderTOG0-false, orderNum=lj BurgerOrd ambur

FastFoodKitchen class

package ques4;

import java.util.*;

public class FastFoodKitchen {
   private List<BurgerOrder> orderList = new ArrayList<>();
   private static int nextOrdernum;
  
  
   public FastFoodKitchen(List<BurgerOrder> orderList) {
       super();
       //creating BurgerOrder objects
       BurgerOrder order1= new BurgerOrder(3, 5, 4, 10, false, 1);
       BurgerOrder order2= new BurgerOrder(0, 0, 3, 2, true, 2);
       BurgerOrder order3= new BurgerOrder(1, 1, 0, 2, false, 3);
       orderList.add(order1);
       increamentNextOrdernum();
       orderList.add(order2);
       increamentNextOrdernum();
       orderList.add(order3);
       increamentNextOrdernum();
      
   }
  


   public List<BurgerOrder> getOrderList() {
       return orderList;
   }

   public void setOrderList(List<BurgerOrder> orderList) {
       this.orderList = orderList;
   }

   public static int getNextOrdernum() {
       return nextOrdernum;
   }
   public int addOrder(int ham, int cheese, int veg, int soda, boolean TOGO)
   {
       BurgerOrder newOrder= new BurgerOrder(ham, cheese, veg, soda, TOGO, getNextOrdernum());
       orderList.add(newOrder);
       int orderID=getNextOrdernum();
       increamentNextOrdernum();
       return orderID;
   }
   public boolean isOrderDone(int orderID)
   {
       //loops through the orderList
       for(BurgerOrder order: orderList)
       {
           if(order.getOrderNum()== orderID)
               return false;
       }
       return true;
   }

   public static void increamentNextOrdernum()
   {
       nextOrdernum++;
   }
   public void orderCallout(BurgerOrder argorder)
   {
       for(BurgerOrder order: orderList)
       {
           //checks atleast if one is true
           if(order.getNumHamburgers()==argorder.getNumHamburgers() || order.getNumCheeseburgers()== argorder.getNumCheeseburgers() || order.getNumVeggieburgers()==argorder.getNumVeggieburgers() || order.getNumSodas()==argorder.getNumSodas())
               System.out.println(order);
       }
      
   }
   public void completeSpecificOrder(int orderID)
   {
       for(BurgerOrder order: orderList)
       {
           if(order.getOrderNum()== orderID)
               {System.out.println("Order is done!");
               if(order.isOrderTOGO())
                   orderCallout(order);
               //removes order
               orderList.remove(order);
               }
       }
   }
   public void completeNextOrder()
   {
       BurgerOrder order1=orderList.get(0);
       System.out.println("Order is done!");
       if(order1.isOrderTOGO())
           orderCallout(order1);
       orderList.remove(order1);
   }
   public int getNumOforderpending()
   {
       //returns size of arrayList
       return orderList.size();
   }
   //implement this method as given in the question
   /*
   * public void simulateKitchenActivity() {
   *
   * }
   */
   public boolean cancelOrder(int orderID)
   {
       for(BurgerOrder order: orderList)
       {
           if(order.getOrderNum()== orderID)
               {
                   orderList.remove(orderID);
                   return true;
               }
       }
       return false;
   }
   @Override
   public String toString() {
       return "FastFoodKitchen [orderList=" + orderList + "]";
   }
   public static void main(String[] args) {
       // Add additional code given in the question here

   }  

}

UML for BurgerOrder
variables
int numCheeseburgers
int numHamburgers
int numVeggieburgers
int numSodas
boolean orderTOGO
BurgerOrder(int numCheeseburgers, int numHamburgers, int numVeggieburgers, int numSodas, boolean orderTOGO,
           int orderNum)
getNumCheeseburgers()
setNumCheeseburgers(int numCheeseburgers)
getNumHamburgers()
setNumHamburgers(int numHamburgers)
getNumVeggieburgers()
setNumVeggieburgers(int numVeggieburgers)
getNumSodas()
setNumSodas(int numSodas)
isOrderTOGO()
setOrderTOGO(boolean orderTOGO)
getOrderNum()
setOrderNum(int orderNum)
toString()
main()


Hope this helps... Thanks!

Add a comment
Know the answer?
Add Answer to:
Additional code needed: PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please rewrite this code as Pseudo-Code,.. basically rewrite the code but in english language , Thank...

    please rewrite this code as Pseudo-Code,.. basically rewrite the code but in english language , Thank you so much! public abstract class BankAccount {    //declare the required class variables    private double balance;    private int num_deposits;    private int num_withdraws;    private double annualInterest;    private double serviceCharges;       //constructor that takes two arguments    // one is to initialize the balance and other    // to initialize the annual interest rate       public BankAccount(double balance,...

  • You are to create a class Appointment.java that will have the following: 5 Instance variables: private...

    You are to create a class Appointment.java that will have the following: 5 Instance variables: private String month private int day private int year private int hour private int minute 1 default constructor public Appointment() 1 non-default constructor that accepts arguments for all instance variables, your constructor must call the setter methods below to set the values of the instance variables public Appointment(String monthPassed, int dayPassed, int yearPassed, int hourPassed, int minutePassed) 5 setter methods (one for each instance variable)...

  • Use inheritance to create a new class AudioRecording based on Recording class that: it will retain...

    Use inheritance to create a new class AudioRecording based on Recording class that: it will retain all the members of the Recording class, it will have an additional field bitrate (non-integer numerical; it cannot be modified once set), its constructors (non-parametrized and parametrized) will set all the attributes / fields of this class (reuse code by utilizing superclass / parent class constructors): Non-parametrized constructor should set bitrate to zero, If arguments for the parametrized constructor are illegal or null, it...

  • Create a java class that implements BagInterface using singly linked data. Name this new class LinkedBag....

    Create a java class that implements BagInterface using singly linked data. Name this new class LinkedBag. Be sure to include a default constructor to initialize the private members of the class. Test that your code works properly. BagInterface includes the methods:  public int getCurrentSize(); public boolean isEmpty(); public boolean add(T newEntry); public T remove(); public boolean remove(T anEntry); public void clear(); public int getFrequencyOf(T anEntry); public boolean contains(T anEntry); public T[] toArray();

  • Write a second constructor that could be added to the HeapPriorityQueue class. This constructor accepts an...

    Write a second constructor that could be added to the HeapPriorityQueue class. This constructor accepts an array of elements as a parameter and uses that array as the heap rather than creating a new array. Of course, the array passed in is probably not in proper heap ordering, so you must rearrange it until it is. There's a neat trick for achieving this: If you just "bubble down" all of the non-leaf nodes of the heap, starting from the last...

  • Write a second constructor that could be added to the HeapPriorityQueue class. This constructor accepts an...

    Write a second constructor that could be added to the HeapPriorityQueue class. This constructor accepts an array of elements as a parameter and uses that array as the heap rather than creating a new array. Of course, the array passed in is probably not in proper heap ordering, so you must rearrange it until it is. There's a neat trick for achieving this: If you just "bubble down" all of the non-leaf nodes of the heap, starting from the last...

  • Read through the code of the class Player, noting it has two instance variables, name and rank, which are of type String and three further instance variables won, drew and lost which are of type int....

    Read through the code of the class Player, noting it has two instance variables, name and rank, which are of type String and three further instance variables won, drew and lost which are of type int. There is also an attribute of the class, points, which does not have a corresponding instance variable. Also note the constructor and methods of the class and what they do. TournamentAdmin class code: public class RankAdmin {    /**     * Constructor for objects of class...

  • I would like someone to check my code and help with my for loop to print...

    I would like someone to check my code and help with my for loop to print the recipe. It is incorrect. package SteppingStones; import java.util.Scanner; //Scanner class// import java.util.ArrayList; //ArrayList// import ingredients.Ingredient; /**Gets from package ingredients and class Ingredient * * @author kimbe */ public class SteppingStone5_Recipe {    //Instance Variables// private ArrayList recipeIngredients; private String recipeName; private int servings; private double totalRecipeCalories;                   //Setter and Getters//    public ArrayList getrecipeIngredients() { return recipeIngredients; }...

  • // Client application class and service class Create a NetBeans project named StudentClient following the instructions...

    // Client application class and service class Create a NetBeans project named StudentClient following the instructions provided in the Starting a NetBeans Project instructions in the Programming Exercises/Projects Menu on Blackboard. Add a class named Student to the StudentClient project following the instructions provided in the Starting a NetBeans Project instructions in the Programming Exercises/Projects Menu on Blackboard. After you have created your NetBeans Project your application class StudentC lient should contain the following executable code: package studentclient; public class...

  • Create a TicTacToe class that initializes a 3x3 board of "-" values. We will use this...

    Create a TicTacToe class that initializes a 3x3 board of "-" values. We will use this class in future exercises to fully build out a Tic Tac Toe game! The TicTacToe class should have a 2D array as an instance variable and a constructor that initializes the 2D array with the "-" value. Add a getter method that returns the private 2D instance variable. public class TicTacToeTester { //You don't need to alter any of the code in this class!...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT