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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a description of the item.intReturns the insured value of the item, in cents.booleanReturns whether the item is hazardous.intReturns the list price of the item, in cents.intReturns the lowest price, in cents, we will accept.voidsetBox(int h, int w, int d) Sets the dimensions of the item's box, in centimeters.intweight()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:
descriptionin 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:
lowestPricein interfaceSellable- Returns:
- the lowest price, in cents, we will accept
-
weight
public int weight()Returns the weight of the item, in grams.- Specified by:
weightin interfaceTransportable- Returns:
- the weight of the item, in grams
-
isHazardous
public boolean isHazardous()Returns whether the item is hazardous.- Specified by:
isHazardousin 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:
insuredValuein 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
-