$35
This task is to be completed as a new project in Eclipse (closed book, so no referring to/copying from other previously completed projects).
When you are done, put the entire project folder into a .zip file and upload to this Assignment on Canvas via the Submit Assignment button. After you submit, the button will change to "Re-submit" and a record of any files you have uploaded will be displayed in case you need to check/verify as in screenshot below.
It is your responsibility to keep an eye on your time and ensure you submit the required files on time. Allocated Time: 2 hrs 30 mins so ending at 20:45 (deadline adjusted for those students entitled to extra time)
PLEASE INCLUDE YOUR NAME AND STUDENT NUMBER IN THE COMMENTS AT THE TOP OF
EACH JAVA FILE YOU SUBMIT
Example of upload interface after submission
A pdf version of this page is available for download here if preferred: problemSpec.pdf
(https://canvas.qub.ac.uk/courses/11041/files/1567593/download?download_frd=1)
Also links to download the provided sample csv files linked here at the top, as well as at the point in the spec where they are required: OrderList-1-BasicOnly.csv
(https://canvas.qub.ac.uk/courses/11041/files/1567133/download?download_frd=1) , OrderList-2PizzasOnly.csv (https://canvas.qub.ac.uk/courses/11041/files/1567134/download?download_frd=1) , OrderList-3-Full.csv (https://canvas.qub.ac.uk/courses/11041/files/1567135/download?
download_frd=1)
Pizza Shop
Section 1 (55% of available marks)
The scenario to be implemented is a pizza/takeaway shop. The UML diagram below (fig 1.) and associated business rules represent the initial state of the program required, then some additional tasks and expansions are detailed in the next section.
Implement the Classes outlined in the diagram and a driver class PizzaShop.java with a main method to test and demonstrate the functionality of those classes.
Some sample console output is given as an example at the end in fig 2. Layout/formatting should be tidy, but doesn't need to match perfectly.
Business Logic:
Topping - can be String or enum (Developer choice, enum preferred)
MenuItem - represents simple non customisable items with just a name and price eg Drinks/Burgers etc.
Name must be non empty String. Letters and Spaces only and must not begin with a space.
(otherwise “INVALID NAME”)
Price: non negative, zero if invalid
Pizza - represents Pizzas which could be plain with no additional toppings or with a choice of toppings added which affects the price
Main required constructor for Pizza(int size) - creates a plain pizza of a given size. Additional constructor(s) as developer sees fit.
base price should equal size and name standardised e.g. size: 8, price: £8.00, name: Pizza
Size between 8 and 16 - set to 8 if smaller value given, 16 if bigger
Base price, then 50p for each additional Topping. Only 1 of each topping possible.
Some example toppings which could be used:
Section 2 (45% of available marks)
Next Steps and Expansions
Add a static method printReceipt to PizzaShop which receives an ArrayList of MenuItem objects and prints a summarised receipt to the console, itemising items and a total price.
(layout should be tidy, but doesn’t need to be perfect)
Add a method isVegetarian() to the Pizza class which will return true if none of the Toppings are Meat based and false otherwise
Add a static method findVeggies to PizzaShop which receives an ArrayList of MenuItem objects and counts the number of Vegetarian pizzas which are in that list and prints the details of each. Add a static method to PizzaShop which will read from an appropriately formatted csv file (samples provided) and return an ArrayList of MenuItems – consideration for invalid values in file/handling exceptions appropriately
Sample files: OrderList-1-BasicOnly.csv
(https://canvas.qub.ac.uk/courses/11041/files/1567133/download?download_frd=1) -
OrderList-2-PizzasOnly.csv
(https://canvas.qub.ac.uk/courses/11041/files/1567134/download?download_frd=1) - OrderList-3-Full.csv (https://canvas.qub.ac.uk/courses/11041/files/1567135/download?
download_frd=1)
****Expansions and searches Tests****
Test receipt method -------------- ORDER DETAILS
--------------
Burger £5.50 Custom Pizza (8) £9.50 with toppings: * PEPPERS
* PINEAPPLE
* EXTRACHEESE
Plain Pizza (8) £8.00 Custom Pizza (8) £9.50 with toppings: * MUSHROOMS * OLIVES
* EXTRACHEESE
--------------
Total cost: £32.50
--------------
Test veggie search method Veggie 1) Custom Pizza (8) £9.50 with toppings: * PEPPERS
* PINEAPPLE
* EXTRACHEESE
Veggie 2)
Plain Pizza (8) £8.00
Veggie 3) Custom Pizza (8) £9.50 with toppings: * MUSHROOMS * OLIVES
* EXTRACHEESE
A total of 3 Veggie Pizzas in this list
Test file read method (by printing receipt)
-------------- ORDER DETAILS
--------------
Burger £2.50 Custom Pizza (12) £14.00 with toppings: * CHICKEN
* EXTRACHEESE * PEPPERS
* BEEF
Coke £0.80
Chicken Nuggets £1.50 Custom Pizza (14) £14.50 with toppings:
* EXTRACHEESE Custom Pizza (8) £9.50 with toppings: * EXTRACHEESE * HAM
* PINEAPPLE
Cheeseburger £2.95
Coke £0.80
Plain Pizza (14) £14.00 Chips £2.50
Chips £2.50
Plain Pizza (10) £10.00 Custom Pizza (13) £14.00 with toppings: * PEPPERS * ONIONS
fig 2. Sample console output