subject

Part 1 scoping and multiple constructors create a class named pizza that stores information about a single pizza. it should contain the following:

a. private instance variables to store the size of the pizza (either small, medium, or large), the number of meat toppings, the number of veggie toppings and whether or not the pizza should be vegan-friendly (in which case you must make sure that the number of meat toppings is 0). discuss with your partner what the difference between a private and public instance variable is.
b. constructors that set all of the instance variables. one constructor should be a no-arg constructor, with defaults of medium, no toppings, non-vegan.
c. at least one other constructor should enable you to give all the private instance variables a value when you create the object. you should also include error checking to make sure the values you are setting are legitimate (e. g., there is no such a size pizza as "grande"). discuss with your partner why there is more than one kind of constructor and when will each constructor be used.
d. public methods to get and set the instance variables. discuss with your partner what would happen if these methods were set to private and why these accessor and getter methods are needed. a public method named calccost that returns a double that is the cost of the pizza. pizza cost is determined by:

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:30
Which of the choices sean are not true when considering virus behavior
Answers: 1
question
Computers and Technology, 22.06.2019 22:20
Pp 4.1 design and implement a class called sphere that contains instance data that represents the sphere’s diameter. define the sphere constructor to accept and initialize the diameter and include getter and setter methods for the diameter. include methods that calculate and return the volume and surface area of the sphere (see pp 3.5 for the formulas). include a tostring method that returns a one-line description of the sphere. create a driver class called multisphere, whose main method instantiates and updates several sphere objects.
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
Donna and her team of five have invented a new gadget for the science exhibition in their college. which intellectual property right will protect their invention?
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
Select the correct answer. a company is currently focusing on creating specific management goals for itself. which level of maturity is the company demonstrating under the sse_ccm framework? a. performed informally b. planned and tracked c. quantitatively controlled d. well-defined e. continuously improving
Answers: 2
You know the right answer?
Part 1 scoping and multiple constructors create a class named pizza that stores information about a...
Questions
question
Mathematics, 30.10.2020 03:00
question
Mathematics, 30.10.2020 03:00
question
Mathematics, 30.10.2020 03:00
question
Business, 30.10.2020 03:00
question
Mathematics, 30.10.2020 03:00
question
Mathematics, 30.10.2020 03:00
question
History, 30.10.2020 03:00
question
Mathematics, 30.10.2020 03:00
question
Mathematics, 30.10.2020 03:00