Question: Pizza Ordering System SKILLSET: ArrayLists of objects PizzasRUs needs a system to create and process customer orders. They sell pizzas in 3 sizes: small, medium,
Pizza Ordering System SKILLSET: ArrayLists of objects PizzasRUs needs a system to create and process customer orders. They sell pizzas in 3 sizes: small, medium, large. The user can add as many toppings as they like. NOTE: You can assume all user data is VALID. Pizza has a base price based on size: small = 10, medium = 14, large = 17 Then add $2.50 for each topping This lab uses ArrayLists in TWO ways An ArrayList INSIDE the class to keep a list of pizza toppings An ArrayList of pizza OBJECTS (the orders) in the app Make sure you have a clear vision of this before you start coding. READ THE INSTRUCTIONS SEVERAL TIMES. Your project will have 2 classes (Please use these names): Pizza PizzaApp Create a class called Pizza that represents a single pizza order. Required class attributes and methods are as follows: Private class attributes: Customer name Size of pizza (S, M, L. you decide whether to use String or char, make sure to store as uppercase) An ArrayList of strings that represents the toppings Class Methods: Default constructor (choose appropriate default values) set/get for size set/get for customer name addTopping receives a string representing a single topping, and adds it to the ArrayList of toppings in the class getPrice calculates and returns the price of the pizza display displays the pizza order in the format shown below: Customer name: xxx (size) pizza with (num) toppings (list toppings) Price: $xx.xx Make sure you code AND TEST EACH CLASS METHOD FIRST. If they all work correctly, it will be simple to build the app. Your app will collect orders from multiple customer, so you will have an ArrayList of type Pizza to represent all pizza orders. Your menu will have options to (1) take and price a customers order, and (2) print all orders. When you exit the menu, you will print a summary of pizza sales at the end of the day. [Note that in this case it will NOT be convenient to add orders to the arraylist using a parameterized constructor. In fact we cant easily make a parameterized constructor because we dont know how many toppings there will be, they are added one at a time. So your app will need to create a Pizza object, store the size, add toppings, store name, and then add this object to the ArrayList.] For full credit your app must NOT have ALL the code in main. Create static methods to partition/modularize your code. The menu and loop to process it should be in main, but make methods to process the options (new order, show orders, order summary). These are public static app methods (in PizzaApp). Make sure you clearly define the job description of any method you write in order to determine its inputs and output (if any). You only need to validate the menu option (only 1, 2, 3). This is JUST a sample output to show the formatting requirements. Do some additional testing of your own. Make sure you test all the features of the app. Output Formatting 1 - New order 2 - Show all orders 3 - Exit Your choice: 1 Enter size (S, M, L): m Enter a topping, enter x when done: sausage Enter a topping, enter x when done: mushroom Enter a topping, enter x when done: x Enter customer name: Stef YOUR ORDER Customer name: Stef medium pizza with 2 toppings sausage mushroom Price: $19.00 1 - New order 2 - Show all orders 3 - Exit Your choice: 1 Enter size (S, M, L): L Enter a topping, enter x when done: pepperoni Enter a topping, enter x when done: sausage Enter a topping, enter x when done: olives Enter a topping, enter x when done: x Enter customer name: Klay YOUR ORDER Customer name: Klay large pizza with 3 toppings pepperoni sausage olives Price: $24.50 1 - New order 2 - Show all orders 3 - Exit Your choice: 2 Customer name: Stef large pizza with 2 toppings sausage mushroom Price: $19.00 Customer name: Klay large pizza with 4 toppings pepperoni sausage ham olives Price: $24.50 1 - New order 2 - Show all orders 3 - Exit Your choice: 3 Order Summary Customer Size Price Stef M 19.00 Klay L 24.50 Total sales: $43.50
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
