Question: 1. Create a class called Pizza 2. Pizza has 4 instance variables: An int variable called numSlices that stores the number of slices to cut


1. Create a class called Pizza 2. Pizza has 4 instance variables: An int variable called numSlices that stores the number of slices to cut the pizza into A String array called toppings that stores all the toppings as Strings A boolean variable hasCheese that stores whether or not the pizza has cheese on it (Cheese does not count as a topping) A boolean variable isGlutenFree that stores whether or not the pizza is gluten free. The default for a regular pizza is cut into 8 slices, has 0-toppings, cheese, and is not gluten-free. 3. Pizza has 2 constructors A constructor that doesn't take in any arguments and makes a pizza with the default values for a regular pizza (A pizza with zero toppings should have an empty topping array) A constructor that takes in a request for how many slices, a value for cheese, a value for gluten free, and a String array of toppings in that order) 4. Pizza has the following methods: A method that returns the array of toppings and a method that sets the of toppings to a passed in array: - get Toppings - setToppings A method that returns the number of slices and a method that sets the number of slices to a passed in value: - getNumSlices - set NumSlices A method that sets the hasCheese field to a passed in value: - setHasCheese A method that sets the gluten Free field to a passed in value: - set IsGlutenFree a method printToppings that prints out the array of toppings in the following format: Pizza Toppings: {topping 1} {topping 2} a method changeFirst Topping that takes in a String and changes the first element in the topping array (if the array is of sufficient length) to be the String passed in. If the array is not of sufficent length, this method should do nothing. This method should not return anything
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
