Question: Cake Class Write a class Cake that inherits from Item . Cake s come in a size, given in inches, have a design on them,

Cake Class
Write a class Cake that inherits from Item . Cake s come in a size, given in inches, have a design on them, and can
either be square or round.
Here's some more information to help you write your Cake class:
the design on the cake is just a description of the design
the size is just a number given in inches, like 12,24,7,6, etc.
for round or square, you'll just put whether or not (so true or false, hint hint) the cake is square
Include getters and setters for each of these attributes.
Include a constructor with parameters for each of the attributes. Keep in mind how constructors work with
inheritance.
Cookie Class
Write a Cookie class that inherits from Item. Cookie s have a quantity and can (or not) come in a fancy tin.
Here's some more information to help you write your Cookie class:
the quantity is a number like 6,12, or 24. Remember that you can only buy whole cookies, so the quantity
wouldn't be something like 12.5.
a special tin can be purchased to put the cookies in, so you'll just put whether or not the cookies are in an tin
Include getters and setters for each of these attributes.
Include a constructor with parameters for each of the attributes. Keep in mind how constructors work with
inheritance.
Testing
Feel free to write a constructor for your class that tests the following:
Create a Cake object
Display at least one of its attributes using its getter
Change at least one using its setter
Verify this change with the getter
Create a Cookie object
Display at least one attribute using its getter
Change at least one attribute
Verify this change again with the getterTask
Write a class named order to represent an order in our Bakery. For right now, Order sin our Bakery include the
Item s the customer is ordering, and an order number. Here are more details for each:
items : these are the Item object the user is placing the order for. This could be one item or27, but you don't
know that up front, sobe sure to use an ArrayList for storing this data
orderNumHelper : this is a static variable that is used to help generate the next order number. Initialize itto
orderNum : this is a non-static attribute that is used to store the order number for this order
Additionally, you'll need the following methods:
a method to addItems to the order. It should have a single parameter, an Item to add. It should use the copy
constructor (from Item)to add the Item to the ArrayList
a constructor with no parameters. In this constructor:
initialize your ArrayList if you haven't already (i.e., new ArrayList>(); )
assign your orderNum
increment your orderNumHelper to the next value in the sequence
and a toString that displays a receiptpurchase order for the order. When displayed, it should look something
like this:
Cake Class Write a class Cake that inherits from

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!