Package com.zybooks.dsaj.design
Class BoxedItem2
java.lang.Object
com.zybooks.dsaj.design.BoxedItem2
- All Implemented Interfaces:
Insurable
,Sellable
,Transportable
Class for objects that can be sold, packed, and shipped.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns a description of the item.int
Returns the insured value of the item, in cents.boolean
Returns whether the item is hazardous.int
Returns the list price of the item, in cents.int
Returns the lowest price, in cents, we will accept.void
setBox
(int h, int w, int d) Sets the dimensions of the item's box, in centimeters.int
weight()
Returns the weight of the item, in grams.
-
Constructor Details
-
BoxedItem2
Constructor- Parameters:
desc
- a description of the itemp
- the price of the item in centsw
- the weight of the item in gramsh
- true if object is hazardous
-
-
Method Details
-
description
Returns a description of the item.- Specified by:
description
in interfaceSellable
- Returns:
- a description of the item
-
listPrice
public int listPrice()Returns the list price of the item, in cents. -
lowestPrice
public int lowestPrice()Returns the lowest price, in cents, we will accept.- Specified by:
lowestPrice
in interfaceSellable
- Returns:
- the lowest price, in cents, we will accept
-
weight
public int weight()Returns the weight of the item, in grams.- Specified by:
weight
in interfaceTransportable
- Returns:
- the weight of the item, in grams
-
isHazardous
public boolean isHazardous()Returns whether the item is hazardous.- Specified by:
isHazardous
in interfaceTransportable
- Returns:
- true if the item is hazardous, else false
-
insuredValue
public int insuredValue()Returns the insured value of the item, in cents.- Specified by:
insuredValue
in interfaceInsurable
- Returns:
- the insured value of the item, in cents
-
setBox
public void setBox(int h, int w, int d) Sets the dimensions of the item's box, in centimeters.- Parameters:
h
- the height of the boxw
- the width of the boxd
- the depth of the box
-