To develop object-oriented programming skills, including designing, documenting, testing, and debugging of Java code.
Your task is to develop a Pizza ordering system. The ordering system will take inputs from the user on the console and then display a picture of the chosen pizza with the associated cost. This ordering system is slightly different to other ordering systems in that users are limited in their pizza choices. They will be limited to 6 pizzas and will only be able to choose 2 different types of topping, depending on your student number. The users will be able to choose their pizzas using a text-based interface. The total price of the order is displayed at the bottom of a graphical display screen.
The below example shows an order of the following 4 pizzas:
Figure 1: see image.
To help you get started, a project called "PizzaOrderSystem" is available on Moodle. This provides some of the functionality that the final program will need. However, much needs adding. Study this project and understand how the code in PizzaMain, OrderingSystem, and Pizza works before you start working on this coursework. You should not need to change the PizzaMain file.
2.1. Pizza Elements
The user will need to enter all the details of their chosen pizzas using a text-based interface, in the console. All the pizzas must be drawn within the provided display window, which will contain at most 6 pizzas, together with the total price of the order.
For each pizza, the user will have the following choices:
2.1.1. Pizza Base and Sauce
The user should be able to choose from 3 sizes for each pizza:
In addition to the size, the user should be able to choose between 3 types of crust:
All the crusts come with a tomato sauce and mozzarella topping by default. However, for each pizza the user should have the option to change the sauce from tomato to BBQ, at an additional cost.
2.1.2. Pizza Toppings
The user has the choice of up to two toppings for their pizza. The pizza company will put 5 pieces of their first chosen topping on the pizza, and 4 of the second topping. The user is able to choose the same topping twice, in which case, there will be 9 pieces of topping on the pizza.
The below table shows all the possible toppings for the pizza: see image.
You need to implement 2 toppings based on the last 2 numbers of your student ID. For example, if your student number is 888114, you will need to implement toppings 1 and 4, which are pepperoni and prawn, respectively.
If the last 2 numbers of your student ID are the same, you will need to subtract one of the numbers from 9, then implement the resulting number too. For example, if your student number is 888111, you will need to implement toppings 1 and 8 (as 9 - 1 = 8), which are pepperoni and red onion, respectively.
2.2. Pricing
You will also need to calculate the total price of all the pizzas which have been ordered. To calculate the price of each pizza, the following pricing structure should be used:
Base Description | Price (per square inch) |
Deep Pan | 11p |
Thin Crust | 8p |
Stuffed Crust | 14p |
Sauce Description | Price (single price for all pizza sizes) |
Tomato | 0p |
BBQ | 50p |
Number | Topping Description | Price (per piece) |
0 | Pineapple | 6p |
1 | Pepperoni | 4p |
2 | Crispy Bacon | 2p |
3 | Mushroom | 5p |
4 | Prawn | 6p |
5 | Japaleno Slice | 4p |
6 | Pepper | 2p |
7 | Tuna | 8p |
8 | Red Onion | 3p |
9 | Anchovy | 7p |
For example, the following is a medium deep pan pizza, with BBQ sauce and both mushrooms and peppers: see image.
The total price will be 13.27. This can be broken down as follows:
2.3. User Interface
The display screen has been provided in the starter project for this coursework - you should not change the layout of this screen. All your interactions with the ordering system should be completed using a text- based interface in the console (using the KeyboardInput class provided in the starter pack). The program's user interface should be easy to use, friendly, and robust. For example, if the user inputs invalid data the user should receive an appropriate error message, and be re-prompted until the entered data is valid.
Basic Functionality (50% of the marks): The user should be able to enter up to a maximum of 6 pizzas, which should be displayed within the window provided. For each pizza, the user should be prompted to enter the following information (separately, not in one line):
The system should stop prompting once the order has reached 6 pizzas, or if the user decides to finish before 6 have been ordered. After each entry, the graphical display should be updated to show the new pizza, and the new total price.
Extended Functionality: The system should be adapted so that users can change or remove any pizzas they have already entered. In addition, the user should be able to enter more than 6 pizzas - continuing until they are finished. The maximum number of pizzas on the screen should remain at 6, but the user should be able to change the page using the text-based interface.