subject
Computers and Technology, 08.07.2019 16:10 nick607

The abstract class dessert contains data members name and cost. it also defines public methods string which returns the name of the dessert, and public method int implement both of these methods and the standard methods tostring() (return the name and cost of the dessert concatenated in a string) and equals(object) in the following subclasses: • the cake class is derived from the dessert class. a cake object has a number of layers (int). the price of a cake is $15 + $2 per layer. for example, a 3-layer cake costs $21. the number of layers is passed as the parameter to the cake constructor. • the cookiepack class is derived from the dessert class. a cookiepack object has a number (int) indicating how many cookies are in the pack and a price per cookie in dollars (int) which are used to determine its cost. for example, a 5-cookie pack at $2 per cookie = $10. the name/type of the cookies (e. g., chocolate chip cookies) and these two integers are passed in as the parameters to the cookiepack constructor. • the icecream class is derived from the dessert class. an icecream object simply has a cost in dollars (int). the starting value of this cost is passed as the parameter to the icecream constructor. • the sundae class is derived from the icecream class. the cost of a sundae is the cost of the icecream plus the cost of the topping in dollars (int). the starting value of the topping’s cost is passed as a parameter to the sundae constructor.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:00
Which requirement is an appropriate reason for a business to use it tools
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
All of the following are characteristics that must be contained in any knowledge representation scheme except
Answers: 3
question
Computers and Technology, 23.06.2019 01:50
Free points just awnser this. what should i watch on netflix
Answers: 2
question
Computers and Technology, 23.06.2019 14:00
In which job role will you be creating e-papers, newsletters and preiodicals
Answers: 1
You know the right answer?
The abstract class dessert contains data members name and cost. it also defines public methods strin...
Questions
question
Biology, 12.12.2020 15:50
question
Mathematics, 12.12.2020 15:50
question
History, 12.12.2020 15:50
question
Mathematics, 12.12.2020 15:50
question
Chemistry, 12.12.2020 15:50
Questions on the website: 13722362