MenuItem.java

/* * You will likely have to change or remove the package when you use this file. */ package ist140.labs; /** * * @author smv159 */ public class MenuItem { //Field Variables private String food; private double price; private String drink; private String toy; private boolean eaten; public MenuItem() { food = ""; price = 0; drink = ""; toy = ""; eaten = false; } MenuItem(String food, double price, String drink, String toy) { this.food = food; this.price = price; this.drink = drink; this.toy = toy; eaten = false; } public String getFood() { return food; } public void setFood(String food) { this.food = food; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public String getDrink() { return drink; } public void setDrink(String drink) { this.drink = drink; } public String getToy() { return toy; } public void setToy(String toy) { this.toy = toy; } public boolean isEaten() { return eaten; } public void setEaten(boolean eaten) { this.eaten = eaten; } //#6 - Create the toString method public String toString() { return "MenuItem:\n" + "Food: " + food + "\n" + "Price: $" + price + "\n" + "Drink: " + drink + "\n" + "Toy: " + toy + "\n" + "Food " + (eaten ? "was eaten." : "was not eaten yet.") + "\n"; } }