Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In our Abstract Classes and Interfaces lesson, we rewrote DataSetBook to take any object that implemented the Measurable interface. As several of you have noted,

In our Abstract Classes and Interfaces lesson, we rewrote DataSetBook to take any object that implemented the Measurable interface. As several of you have noted, a Boat may implement Measurable, a Book may implement Measurable, and a Building may implement Measurable, but mixing boats and books and buildings in the same data store makes little sense. Generics give the application writer compile-time help in keeping boats and buildings out of his book store. A Book and DataSetBook classes and a Measurable interface are provided, but feel free to rewrite them if that seems easier. You may also wish to start from a different version of DataSet; that's up to you. You are to write a generic class DataSetGeneric. DataSetGeneric should provide the usual add, size, getMin, getMax and toString methods. This should be a generic class so that only elements of the specified type are allowed into the data store. All of its elements should implement the Measurable interface, however; that's what you will rely on to implement getMin and getMax. Also provide a tester for DataSetGeneric.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions

Question

Determine the payback period for an investment opportunity.

Answered: 1 week ago

Question

4. What are the current trends in computer software platforms?

Answered: 1 week ago