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

Java Programming Question

Java Programming 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 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 1sGluten Free that stores

whether or not the pizza is gluten free. The default for a

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 1sGluten Free 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: - get NumSlices - 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 IsGluten Free a method print Toppings that prints out the array of toppings in the following format: Pizza Toppings: {topping 1} {topping 2} a method change First 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. Notes variable names should be exactly as specified getters and setters should follow java naming conventions constructors should take the arguments in order given arrays have a length value that can be used to get the number of elements they have arrays can also be of length 0, but there are implications of this you are not allowed to import: - java.util.ArrayList do not use any of the following var (the reserved keyword) System.exit

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!