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 18:30
Which of these options are the correct sequence of actions for content to be copied and pasted? select content, click the copy button, click the paste button, and move the insertion point to where the content needs to be inserted. click the copy button, select the content, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, click the copy button, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, move the insertion point to where the content needs to be inserted, click the copy button, and click the paste button.
Answers: 3
question
Computers and Technology, 23.06.2019 06:40
How many nibbles can be stored in a 16-bit word?
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
The more powerful, 60 volt cables and the main power shut-off on an hev are both colored orange.
Answers: 1
question
Computers and Technology, 24.06.2019 00:30
Afiling system in which an intermediary source of reference, such as a file card, must be consulted to locate specific files is called a(n) system. a. shelf filing b. direct filing c. indirect filing d. shingling
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
English, 30.11.2020 20:30
question
Chemistry, 30.11.2020 20:30
question
Mathematics, 30.11.2020 20:30
Questions on the website: 13722361