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 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 or Remember that you can only buy whole cookies, so the quantity
wouldn't be something like
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 represent order our Bakery. For right now, Order our Bakery include the
Item the customer ordering, and order number. Here are more details for each:
items : these are the Item object the user placing the order for. This could one item but you don't
know that front, sure use ArrayList for storing this data
orderNumHelper : this a static variable that used help generate the next order number. Initialize
orderNum : this a nonstatic attribute that used store the order number for this order
Additionally, you'll need the following methods:
a method addItems the order. should have a single parameter, Item add. should use the copy
constructor Item add the Item the ArrayList
a constructor with parameters. this constructor:
initialize your ArrayList you haven't already new ArrayList;
assign your orderNum
increment your orderNumHelper the next value the sequence
and a toString that displays a receipurchase order for the order. When displayed, should look something
like this:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
