Question: Design a class named Fish which stores a String lake identification ( ex . 1 1 1 1 ) , a String fish species (

Design a class named Fish which stores a String lake identification (ex.1111), a String fish species
(ex.Pickerel) and a double weight in pounds (ex.4.56). Provide constructors, accessors, modifiers,
equals, and toString methods. Fish class should implement the Comparable interface, overriding the
compareTo method where comparison is performed on the String lake identification field.
2. Write a SpeciesComparator class which implements the Comparator class, overriding the
compare method where comparison is performed on the String fish species field.
3. Write a WeightComparator class which implements the Comparator class, overriding the
compare method where comparison is performed on the double fish weight field.
4. Implement a generic bubble sort method which can be passed any reference type that implements the
Comparable interface and the number of elements in the array. Use the method heading shown below.
public static > void bubbleSort(T [] data, int size)
5. Implement a generic bubble sort method which can be passed any reference type, the number of
elements in the array, and a Comparator for that type. Use the method heading shown below.
public static void bubbleSort(T [] data, int size, Comparator c)
6. Write a console application which opens file fishdata.txt and reads the data into an array. There is
one data set per line, separated by the comma. The number of data points is unknown so code should
work for any non-empty file. Be sure to resize the array as needed if it fills from your initial capacity.
Present a menu of sort choices. The user
selects the sort choice and the data appears
sorted by that field.
A sample run is shown, sorting on the
weight.
Design a class named Fish which stores a String

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!