Java Reference
In-Depth Information
Complete the method getEnumeration() so that it returns an anonymous inner
class that corresponds to the Enumeration interface for the names array in
NamesCollection . Then write a main method that creates a NamesCollection
object with a sample array of strings, retrieves the Enumeration for this class via
getEnumeration() , and then iterates through the enumeration outputting each
name using the getNext() method.
4.
In Display 13.5, we described a sorting method to sort an array of type Comparable[] .
In Display 12.6, we described a sorting method that used the merge sort algorithm to
sort an array of type double[] into increasing order. Redo the method in Display 12.6
so it applies to an array of type Comparable[] . Also, do a suitable test program.
5.
In Display 13.5, we described a sorting method to sort an array of type Comparable[] .
In Display 12.8, we described a sorting method that used the quick sort algo-
rithm to sort an array of type double[] into increasing order. Redo the method
in Display 12.8 so it applies to an array of type Comparable[] . Also, do a suitable
test program.
6.
Redo the class Person in Display 5.19 so that it implements the Cloneable interface.
This may require that you also redo the class Date so it implements the Cloneable
interface. Also, do a suitable test program.
7.
Redo the class Person in Display 5.19 so that the class Date is a private inner
class of the class Person . Also, do a suitable test program. (You need not start
from the version produced in Programming Project 6. You can ignore Program-
ming Project 6 when you do this project.)
8.
This is a combination of Programming Projects 6 and 7. Redo the class Person in Dis-
play 5.19 so that the class Date is a private inner class of the class Person and so that the
class Person implements the Cloneable interface. Also, do a suitable test program.
9.
Redo the class Employee and the class HourlyEmployee in Displays 7.2 and 7.3 so
that the class Date is an inner class of the class Employee and an inherited inner
class of the class HourlyEmployee . Also, do a suitable test program.
Search WWH ::




Custom Search