Question: Using IntellaJ: Create a class named Pizza that stores information about a single pizza. It should contain the following: Private instance variables to store the
Using IntellaJ:
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. 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: o Small: $10 + $2 per topping o Medium: $12 + $2 per topping o Large: $14 + $2 per topping A public method toString() that returns a String containing the pizza size, quantity of each topping, and the pizza cost as calculated by calcCost(). Write main method that asks for pizza size and number of toppings for each category. It should then initialize Pizza class and Print out the Pizza information without explicitly using toString(); The main method will then ask for another pizza, information including pizza size and number of toppings fo
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
