Reference no: EM131952285
Assignment Three
You will create a class named Pizza that stores information for a single pizza. The class should include the following:
1) Private field variables that will store the size of the pizza (small, medium, or large), the number of cheese toppings, the number of pepperoni toppings, and the number of mushroom toppings.
2) A constructor that initializes all of the variables.
3) Public methods to get and set the field variables.
4) A public method named calculateCost() that returns a double value with the cost of the pizza.
Pizza cost is determined by:
Small: $10 + $2 per topping
Medium: $12 + $2 per topping
Large: $14 + $2 per topping
Cost should be printed out with the $ and two decimal places.
5) A public method named getDescription() which outputs a description to the screen with the pizza size, quantity of each topping, and the total cost which is called by calculateCost()
You will also create a class called PizzaOrder which will have a main method to create your pizzas. In this main method,
1) You will ask the user to input a pizza size and number of toppings for cheese, pepperoni, and mushroom. Use the constructor to set these values.
2) Print out the description to the screen with getDescription().
3) Restrictions on the input in PizzaOrder: there can be a max of double toppings for cheese, and a max of triple toppings for pepperoni and/or mushroom. Minimum values are zero. You will need to check to make sure the user is entering proper values for the toppings. If they enter an invalid answer, prompt one more time. If they enter an invalid answer a second time, cancel the order and end the program.
Remember to write a program description in comments for your program. You do not need to create a variable dictionary unless you are using variables that are not obviously labelled.