Create an application via NetBeans with named Pizza that stores information about a single pizza. It should contain the following: Private instance variables to
Create an application via NetBeans with named Pizza that stores information about a single pizza. It should contain the following:
• Private instance variables to store the size of the pizza (either small, medium, or large), the number of cheese toppings, the number of beef toppings, and the number of chicken toppings.
• Constructor(s) that set all of the instance variables.
• Public methods to get and set the instance variables.
• A public method named calcCost( ) that returns a double that is the cost of the pizza.
Pizza cost is determined by:
Small: OR10 + OR 2 per topping
Medium: OR 12 + OR 2 per topping
Large: OR 14 + OR 2 per topping
• A public method named getDescription( ) that returns a String containing the pizza size, quantity of each topping, and the pizza cost as calculated by calcCost( ).
• Write test code to create several pizzas and output their descriptions. Use data structure ArrayList to store the data and also use Queue to do the same.
To calculate the price for example, a large pizza with one cheese, one beef and two chicken toppings should cost a total of OR22 as shown below.
Hint:
large += beef * 2; // 14+2=16
large += chicken * 2; //16+4=20
large += cheese * 2;//20+2=22
result = large;// result=22 OR
The output looks like the following screen:
run:
Please enter the size of pizza
1. for small, 2. for medium, 3. for large 4. Exit
Enter your choice:
1
Please enter the number of Beef toppings
1
Please enter the number of chicken toppings
2
Please enter the number of cheese toppings
3
Your Order is created successfully!
The price comes to a total of OR 10.00.
You have ordered: 1 small pizza with 1 beef, 2 chicken, and 3 cheese and the cost is: 22 OR.
Do you want to order another Pizza: 1 Yes, -1 No?
1
Please enter the size of pizza
1. for small, 2. for medium, 3. for large 4. Exit
Enter your choice:
2
Please enter the number of Beef toppings
0
Please enter the number of chicken toppings
0
Please enter the number of cheese toppings
4
Your Order is created successfully!
The price comes to a total of OR 12.00.
You have ordered: 1 medium pizza with 0 beef, 0 chicken, and 4 cheese and the cost is: 20 OR.
Do you want to order another Pizza: 1 Yes, -1 No?
-1
Order Description:
***************************************************************************
You have ordered: 1 small pizza with 1 beef, 2 chicken, and 3 cheese and the cost is: 22 OR.
You have ordered: 1 medium pizza with 0 beef, 0 chicken, and 4 cheese and the cost is: 20 OR.
*****************************************************************************
The Price is: 42 OR. The Tax: 2% =0.02
The total Price is: 42.84 OR.
****************************************************************************
• Submit a neat report containing the solution to the above problem (algorithm)[one for using ArrayList and the other of using Queue].
• Write a Java program to implement this task by using separate functions wherever necessary.
• Mention the total time complexity for the solution you provided and compare between ArrayList and Queue.
• Include the screenshot to demonstrate working solution for different test cases.
Step by Step Solution
3.44 Rating (157 Votes )
There are 3 Steps involved in it
Step: 1
Pizzajava public class Pizza private String size private int nCheeseToppings nBeefToppings nChickenToppings public Pizza thissize small thisnBeefToppings thisnCheeseToppings thisnChickenToppings 0 pub...See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started