Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create an ordering system for a restaurant. The restaurant is to be a pizza rest

ID: 3640990 • Letter: C

Question

Create an ordering system for a restaurant. The restaurant is to be a pizza restaurant located in Miami that sales pizza and drinks. The restaurant has a set menu and each item has associated with it a price and a caloric count.

Create a Restaurant class that has as properties a name, an address and a menu. It should be able to display a menu.

A menu consists of MenuItem type objects that have a name, a price and a caloric calculator. Make the caloric calculator an abstract method.

Create two subclasses Pizza and Drink. The Pizza class should have a crust type and size (two possible)

Create toppings for the pizza and let the customer choose, maximum two toppings. The caloric calculator should calculate the calories based on the type of crust and the toppings. The Drink class should have a type and size ( two possible) and calculate the caloric information based on the type of drink and size.

Create an Order class that has as properties MenuItem , total calories and total price. Calculate the price and calories based on the users input. An order object should print the order with total calories and total price.

Create a test program that creates a Restaurant object. It should initialize the restaurant properties and generate a menu. Display the menu. Create an Order object. Give the user the option to choose an item or build their pizza. Next let them pick a drink. Offer all sizes and types. As the person chooses an object the caloric amount should be shown. Display final order with total caloric and price.

Explanation / Answer

public class Restaurant { //Constants public final static int PIZZA = 0; public final static int DRINK = 1; //Atributes private String name; private String address; private ArrayList menu; private ArrayList orders; //Constructors public Restaurant(String pName, String pAdress) { name = pName; address = pAdress; menu = new ArrayList(); orders = new ArrayList(); } //Methods public void addPizza(String pName, double pPrice, int pSize, int pCrust) { Pizza newPizza = new Pizza(pName, pPrice, pSize, pCrust); menu .add(newPizza); } public void addDrink(String pName, double pPrice, int pSize, int pType) { Drink newDrink = new Drink(pName, pPrice, pSize, pType); menu.add(newDrink); } } ------------------------------------------------------------------------- abstract class MenuItem { //Atributes protected String name; protected double price; protected double calories; //Constructors public MenuItem(String pName, double pPrice ) { name = pName; price = pPrice; calories = 0; } //Methods abstract double calculateCalories(); } ------------------------------------------------------------------------------------------- public class Pizza extends MenuItem { //Constants public int size; public int crust; public Pizza(String pName, double pPrice, int pSize, int pCrust) { super(pName, pPrice); size = pSize; crust = pCrust; } double calculateCalories() { return 0; } } ------------------------------------------------------------------------------- public class Drink extends MenuItem { //Atributes public int size; public int type; //Constructors public Drink(String pName, double pPrice, int pSize , int pType) { super(pName, pPrice); size = pSize; type = pType; } double calculateCalories() { return 0; } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote