Question: MYPROGRAMMINGLAB QUESTION 4.11) Create a class named Pizza that stores information about a single pizza. It should contain the following: Private instance variables to store

MYPROGRAMMINGLAB QUESTION

MYPROGRAMMINGLAB QUESTION 4.11) Create a class named Pizza that stores information about

4.11) 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: Small: $10 $2 per topping Medium: $12 + $2 per topping Large: $14 $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 calcCostO 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 string from getDescriptionO; SAMPLE RUN #4: java Pizza Interactive Session Hide Invisibles Highlight: None Show Highlighted Onl Enter -the -size-of -Pizza:Larged Enter -the number-of -Cheese -toppings:2 Enter -the number-of -Pepperoni -toppings:0. Enter -the number-of -Ham-toppings:1 Large .Pizzawith-2-Cheese-toppings, .0 . Pepperoni-toppings, -and-1-Han-toppings Total Price: -20.0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!