23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Code Fragment 2.10:<br />

Interface Transportable.<br />

We could then def<strong>in</strong>e the class BoxedItem, shown <strong>in</strong> Code Fragment 2.11, for<br />

miscellaneous antiques that we can sell, pack, <strong>and</strong> ship. Thus, the class<br />

BoxedItem implements the methods of the Sellable <strong>in</strong>terface <strong>and</strong> the<br />

Transportable <strong>in</strong>terface, while also add<strong>in</strong>g specialized methods to set an<br />

<strong>in</strong>sured value for a boxed shipment <strong>and</strong> to set the dimensions of a box for shipment.<br />

Code Fragment 2.11 : Class BoxedItem.<br />

118

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!