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 a String fish species
exPickerel and a double weight in pounds ex 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.
Write a SpeciesComparator class which implements the Comparator class, overriding the
compare method where comparison is performed on the String fish species field.
Write a WeightComparator class which implements the Comparator class, overriding the
compare method where comparison is performed on the double fish weight field.
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 bubbleSortT data, int size
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 bubbleSortT data, int size, Comparator c
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 nonempty 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.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
