Question: Pizza Class Instructions: Create a Java program that meets the following requirements: Get Input using a Graphical User Interface Display Output using a Graphical User
Pizza Class
Instructions:
Create a Java program that meets the following requirements:
Get Input using a Graphical User Interface
Display Output using a Graphical User Interface
Create a class 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 pepperoni toppings, and the number of ham toppings.
Constructors 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: $$ per topping
Medium: $$ per topping
Large: $$ per topping
For example, a large pizza with one cheese, one pepperoni and two ham toppings should cost a total of $
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
Use the Pizza constructor to initialize members of Pizza objects.
Output the description of the pizzas using the getDescription method.
Allow the user to order as many pizzas as they want.
Output the cost of each pizza using a GUI.
Output the total cost of all pizzas.
Note: Add additional methods and data structures if they are necessary.
Sample Run:
Input
How many pizzas do you want?
Input
What size do you want your pizza to be: Small, Medium or Large?
Input
Input
How many cheese toppings do you want?
How many ham toppings do you want?
Input
How many pepperoni toppings do you want?
Results
Size: Small, Cheese Toppings: Pepperoni Toppings: Ham Toppings: Cost:
Input
What size do you want your pizza to be: Small, Medium or Large?
Large
Input
Input
How many cheese toppings do you want?
How many ham toppings do you want?
Input
How many pepperoni toppings do you want?
Results
Size: Large, Cheese Toppings: Pepperoni Toppings: Ham Toppings: Cost:
Results
The total cost is:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
