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);
}
}
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
}
}
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!
Additional code needed: PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an...
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 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)...
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();
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...
MasterMind in Java Activity MasterMind project Create a new Java Application project named MasterMind allowing Netbeans IDE to create the main class called MasterMind.java MasterMind class Method main() should: Call static method System.out.println() and result in displaying “Welcome to MasterMind!” Call static method JOptionPane.showMessageDialog(arg1, arg2) and result in displaying a message dialog displaying “Let’s Play MasterMind!” Instantiate an instance of class Game() constants Create package Constants class Create class Constants Create constants by declaring them as “public static final”: public...
signature 1. Create a new NetBeans Java project. The name of the project has to be the first part of the name you write on the test sheet. The name of the package has to be testo You can chose a name for the Main class. (2p) 2. Create a new class named Address in the test Two package. This class has the following attributes: city: String-the name of the city zip: int - the ZIP code of the city...
java Generics Objectives: OOWorking with a Generic Class 1. Create a class called Node that is Generic. The class has one class attribute that is an element. It will need 2 Constructors, a setter and getter for the class attribute, and a toString method. 2. Write a Lab10Driver that will: Instantiate a Node Integer object with no value. I. Il. Ill. IV. a. Then call the set method to set the value to 5. Instantiate a Node String object with...
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!...
Here is a sample run of the tester program: Make sure your program follows the Java Coding Guidelines. Consider the following class: /** * A store superclass with a Name and Sales Tax Rate */ public class Store { public final double SALES_TAX_RATE = 0.06; private String name; /** * Constructor to create a new store * @param newName */ public Store(String newName) { name = newName; } ...
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...