Home / Expert Answers / Electrical Engineering / in-java-code-format-please-assignment-overview-the-goal-of-this-project-is-to-practice-the-progr-pa465

(Solved): In java code format please!! ASSIGNMENT OVERVIEW The goal of this project is to practice the progr ...



In java code format please!!

ASSIGNMENT OVERVIEW

The goal of this project is to practice the programming knowledge and skills that you have acquired so far to implement a pizza ordering system. The user program will provide the user with a menu for ordering pizzas, selecting sizes, and selecting toppings. The menu also provides the ability to order specialty pizzas that have custom configurations and rules that must be incorporated into the program’s logic.

Objectives:

This project focuses on the following learning objectives:

Implementing logic using more complex Java objects and classes

Practicing debugging larger, more sophisticated programs

Applying knowledge of arrays or ArrayLists into your program solution

Applying inheritance to avoid duplication of code logic

Reading:

Read and review the following chapters to assist you in completing this project.

Chapter #7: Arrays & the ArrayList Class

Chapter #8: A Second Look at Classes and Objects

Chapter #10: Inheritance

Assignment Turn-in: You must submit your source code, so we can assess your implementation. In other words, you must submit .java files. If you submit a .class file, you will receive 0 points. You must submit the following .java files. If you decide to use enumerations as part of your design, then those should also be submitted (Size.java and Topping.java)

Driver.java (contains main)

Pizza.java

PizzaOrder.java

Size.java (optional)

Topping.java (optional)

VeggieLoversPizza.java

MeatLoversPizza.java

ASSIGNMENT DETAILS: Part #1: Pizza Class

Referring to the UML diagram below, build a Pizza class. It is recommended using enumerations called Toppings and Size. You can download some sample code defining the Toppings and Size enumerations and a driver class here to assist you here: (Topping.java, Size.java, EnumDriver.java).Figure 1. UML diagram of the \( \mathrm{Pizza} \) class.

Alternative design approaches: Students may (at their discretion) choose to:

Avoid using enumerations and implement the same desired functionality by treating the size and toppings as String data types. If you follow this approach, your mutator (or setter) methods must prevent setting size to anything other than (small, medium, or large) and prevent adding a topping to the array other than (pepperoni, sausage, peppers, or onions).

You can choose to implement the toppings data member as either an ArrayList or an array.
Define fields size and toppings within the Pizza class with data types consistent with the UML design shown above (or

the alternative design options discussed above).
Implement the following methods in addition to the other accessor and mutator methods:

addTopping: adds one additional topping into the toppings array (or ArrayList). Display an error message if the topping has already been added and do not add the topping.

getPrice: returns price of the pizza. Assume that price is $1 per toppings, plus $10 for a small, $15 for a medium, and $20 for a large.

display: Displays to the console the snapshot of the pizza. Follow the formatting standard shown below.

Part \#2: Pizza Order Class
Referring to the UML diagram below, build a PizzaOrder class.
Figure 2. UML diagram of the PizzaO

Define a field that stores an ArrayList of Pizzas (It’s also acceptable to implement this as an array and can assume a max

order size of 20 pizzas). This class should contain the following methods:

addPizza: adds one additional pizza into the array (or ArrayList)

getPrice: Returns the price of all pizzas in the order

display: Displays all the pizzas that have been added to the order following the formatting standards shown

below. In addition to listing the order information, it should display the subtotal, the tax (based off an 8% sales tax rate), and the total that includes taxes. The tax rate should be defined as a private constant variable in the Pizza class.

Part \#3: Veggie Lovers and Meat Lovers Pizza
Referring to the UML diagram below, build the VeggieLoversPizza and MeatLoversP

These classes represent specials that have specific sizes, toppings, and prices which cannot be changed. Override

methods to implement the desired functionality documented below:

• VeggieLoversPizza: o Size:Large

o Toppings: Onions and Peppers

o Price: Special price $17 • MeatLoversPizza:

o Size:Large
o Toppings: Pepperoni and Sausage o Price: Special price $18

If someone attempts to modify these attributes above, they should be prevented from changing these configurations and an error message should be displayed.

Part \#4: Driver Class (Menu)
Implement a driver class called Driver.java. Your driver class should have the following main mIf the user selects  \( S \) , they should be prompted to select one of the two special pizzas. After that selection, the dSelecting  \( Q \)  for Quit will terminate the program.
MAIN MENU:
(0)rder a pizza
(S)pecials list
(R)eceipt diplay
(Q) ui

Figure 1. UML diagram of the \( \mathrm{Pizza} \) class. Part \#2: Pizza Order Class Referring to the UML diagram below, build a PizzaOrder class. Figure 2. UML diagram of the PizzaOrder class. Part \#3: Veggie Lovers and Meat Lovers Pizza Referring to the UML diagram below, build the VeggieLoversPizza and MeatLoversPizza classes, such that they inherit from the Pizza super class. Figure 3. UML diagram of the VeggieLoversPizza and the MeatLoversPizza classes. Part \#4: Driver Class (Menu) Implement a driver class called Driver.java. Your driver class should have the following main menu. MAIN MENU: (0)rder a pizza (S)pecials list (R)eceipt diplay (Q) uit Enter Choice: If the user selects ' \( O \) ' for Order a pizza, they should be prompted to select the pizza size and toppings, as shown below. Follow formatting standards that are consistent with the following example. After the user completes entering the toppings, the display should return to the Main Menu. MAIN MENU: (0)rder a pizza (S)pecials list (R)eceipt diplay (Q) uit Enter Choice: 0 SELECT PIZZA SIZE : (S)mall (M)edium (L)arge Enter Choice: M SELECT TOPPINGS: (P)epperoni (S)ausage (O)nions (B)ell peppers (D)one - no more toppings to add Enter Choice: \( \mathrm{S} \) SELECT TOPPINGS: (P)epperoni (S)ausage (O)nions (B)ell peppers (D)one - no more toppings to add Enter Choice: B SELECT TOPPINGS: (P)epperoni (S)ausage (O)nions (B)ell peppers (D)one - no more toppings to add Enter Choice: D MAIN MENU: (0)rder a pizza (S)pecials list (R)eceipt diplay (Q)uit Enter Choice: If the user selects ' \( S \) ', they should be prompted to select one of the two special pizzas. After that selection, the display should return to the Main Menu (as shown below). MAIN MENU: (0)rder a pizza (S)pecials list (R)eceipt diplay (Q)uit Enter Choice: S SELECT SPECIAL: (V)eggie Lovers Pizza (M)eat Lovers Pizza (B)ack to Main Menu Enter Choice: V MAIN MENU: (0)rder a pizza (S)pecials list (R)eceipt diplay (Q) uit Enter Choice: After the user selects their regular pizza and/or pizza special selections, the user can enter ' \( \mathrm{R} \) ' to display the Order Receipt. Selecting ' \( Q \) ' for Quit will terminate the program. MAIN MENU: (0)rder a pizza (S)pecials list (R)eceipt diplay (Q) uit Enter Choice: Q Exiting Program.... Appendix - Testing Examples Below we provide a few snapshots of full runs and erroneous input. Please compare your program's output to the examples below to ensure that it produces both the same prompts and results. Example 1: Ordering one regular pizza and then printing the receipt (see example \#1) Example \#2: Handling erroneous inputs from the main menu (see example \#2) Example \#3: Handling erroneous inputs from the size menu and toppings menu (see example \#3) Example \#4: Handling erroneous input from the specialty pizza screen Example \#5: Ordering two regular pizzas and a special pizza, then printing the receipt (see


We have an Answer from Expert

View Expert Answer

Expert Answer


Answer:- Summary : Provided Code as per the specifications. Notes : Included validation for few parameters like menu choice and for remaining same log
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe