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 17:00
Acase study allows a more detailed look at the life of a single subject than any other study.
Answers: 3
question
Computers and Technology, 23.06.2019 10:20
Suppose there is a relation r(a, b, c) with a b+-tree index with search keys (a, b).1. what is the worst-case cost of finding records satisfying 10 < a < 50 using this index, in terms of the number of records n1, retrieved and the height h of the tree? 2. what is the worst-case cost of finding records satisfying 10 < a < 50 and 5 < b < 10 using this index, in terms of the number of records n2 that satisfy this selection, as well as n1 and h defined above? 3. under what conditions on n1 and n2, would the index be an efficient way of finding records satisfying the condition from part (2)?
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Open this link after reading about ana's situation. complete each sentence using the drop-downs. ana would need a minimum of ato work as a translator. according to job outlook information, the number of jobs for translators willin the future.
Answers: 3
question
Computers and Technology, 24.06.2019 00:50
Which player type acts on other players? a. killer b. achiever c. explorer d. socializer
Answers: 1
You know the right answer?
Part 1 scoping and multiple constructors create a class named pizza that stores information about a...
Questions
question
Mathematics, 08.04.2021 18:50
question
Mathematics, 08.04.2021 18:50
Questions on the website: 13722360