Question: COP 2800, Java Programming Write Java programs meeting the following requirements Create a Cake class and two subclasses SheetCake and NoveltyCake for a cake shop
COP 2800, Java Programming
Write Java programs meeting the following requirements
Create a Cake class and two subclasses SheetCake and NoveltyCake for a cake shop you can name.
The Cake class contains fields for the flavor of the cake, the cost, and a static variable that contains the slogan of the shop. You set the cost and come up with the slogan. The SheetCake has additional fields for size and filling and decoration. The cost of a 1?4 SheetCake is the same as the cake, 1?2 is twice as much, and a whole SheetCake is 4 times as much. The NoveltyCake has an additional field for type, and costs 5 times as much as Cake. All classes contain appropriate get and set methods for the private fields Create a Java program that declares objects of all three types, Cake, SheetCake and NoveltyCake. Allow the user to enter the data for each cake and display the fields of each object, plus the slogan.
At the beginning of the program add appropriate comments as in previous assignments.
Purpose: Create a java program from detailed directions. Ability to:
Follow established programming standards for writing java programs Use inheritance to create subclasses Create objects from all classes Use data field encapsulation
Using private access to the fields of the classes Use getter and setter methods Use a static variable Use the print statement for output
Put your <
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
