CSC7081 Assessment 2-Pizza Shop Solved

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . zip solution files instantly, after Payment

Description

Rate this product

Pizza Shop

Section 1

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

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