Question
In this project you will create a Java application that simulates the operations of a pizza shop. Users of the pizza shop application will be
In this project you will create a Java application that simulates the operations of a pizza shop. Users of the pizza shop application will be able to create a new order, display all created orders, or exit the application.
An order will consist of some number of pizzas, and some number of drinks. Drinks cost $1.99 each. Pizzas are available in three sizes: small, medium, and large. The base price for each pizza is $5.99 for a small pizza, $7.49 for a medium pizza, and $8.99 for a large pizza. Pizzas may also have an unlimited number of toppings; each topping is an additional 75 cents. Finally, we will track the customer's name with each order.
When creating an order, you will first ask for the customer's name. Next, you will ask if the customer wants to add a pizza to their order. If so, ask if they want a small, medium, or large pizza; then, ask the user to enter the toppings they want. (You may find that a sentinel value helps to determine when the user is done specifying toppings.) Perform these steps for each pizza the customer orders.
After the customer finishes ordering pizzas, the application must prompt the user to enter the names of the drinks in the order. The drinks may be entered as String values, such as "Coca-Cola", "Dr Pepper", or "Dasani". (Again, a sentinel value may help the user to specify when they are finished adding drinks to the order.)
At this point, the order is complete. It should be added to the running list of orders.
When a user chooses to display the orders, all orders since the application started must be displayed on the screen. For each order, the customer's name, the pizzas and their toppings, and the drinks must all be displayed, along with the total price for the order. The price of each individual pizza and the total price of the drinks should be displayed, but this is not required.
Below is an example of what the output could be if a user has created two orders:
Order #1: Customer: Alice Arnold Pizza #1: Size: large 2 Toppings: pepperoni sausage Price: $10.49 Pizza #2: Size: small 0 Toppings Price: $5.99 2 Drinks: Mountain Dew Pure Leaf Sweet Tea Price: $3.98 Total: $20.46 Order #2: Customer: Bert Barclay Pizza #1: Size: medium 1 Topping: extra cheese Price: $8.24 0 Drinks Total: $8.24
When the user exits the application, the orders do not have to be saved. However, you may choose to include options to save the orders to a file and reload them later. Students who successfully implement options for users to save the orders to a file and reload them from a file will receive 15 percent extra credit. These options should allow users to specify the name of the file where they want to save or reload the orders. (Probably the easiest way to perform this is to ensure that the Pizza and Order classes implement the java.io.Serializable interface.)
Attached is a zip file containing skeleton versions of the PizzaShop, Order, and Pizza classes. When implementing the Order and Pizza classes, all methods currently in the classes must be implemented, without any change to their methods' signatures. In the PizzaShop class, the methods named main, createOrder, and displayOrders must be implemented, and the saveOrdersToFile and loadOrdersFromFile may be implemented for extra credit. The signatures of the methods in PizzaShop may be changed (except for main, of course); however, it is possible to implement these methods and maintain the same signatures.
Upload your changes to the PizzaShop, Order, and Pizza classes by the due date. Make sure you upload your Java source files, not your compiled class files.
Order.java code is below
package pizzashop;
import java.util.List;
public class Order {
public String getCustomerName() {
// TODO implement me!
return null; // TODO delete this line!
}
public void setCustomerName(String customerName) {
// TODO implement me!
}
public List
// TODO implement me!
return null; // TODO delete this line!
}
public void setPizzas(List
// TODO implement me!
}
public List
// TODO implement me!
return null; // TODO delete this line!
}
public void setDrinks(List
// TODO implement me!
}
public double getTotalPrice() {
// TODO implement me!
return 0.0; // TODO delete this line!
}
}
pizza.java code is below
package pizzashop;
import java.util.List;
public class Pizza {
public String getSize() {
// TODO implement me!
return null; // TODO delete this line!
}
public void setSize() {
// TODO implement me!
}
public List
// TODO implement me!
return null; // TODO delete this line!
}
public void setToppings(List
// TODO implement me!
}
public double getPrice() {
// TODO implement me!
return 0.0; // TODO delete this line!
}
}
pizzashop.java code is below
package pizzashop;
public class PizzaShop {
public static void main(String[] args) {
// TODO implement me!
}
public static void createOrder() {
// TODO implement me!
System.out.println("createOrder() is not yet implemented."); // TODO delete this line!
}
public static void displayOrders() {
// TODO implement me!
System.out.println("displayOrders() is not yet implemented."); // TODO delete this line!
}
public static void saveOrdersToFile() {
// TODO implement only if you want extra credit
System.out.println("saveOrdersToFile() is not yet implemented."); // TODO delete if needed
}
public static void loadOrdersFromFile() {
// TODO implement only if you want extra credit
System.out.println("loadOrdersFromFile() is not yet implemented."); // TODO delete if needed
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started