Write a generic sort method that restricts the generic type to classes that implement the Comparable interfacefor the generic type. The method should have one parameter, the array to be sorted, whose...

Write a generic sort method that restricts the generic type to classes that implement the Comparable interfacefor the generic type. The method should have one parameter, the array to be sorted, whose type is the generictype.Write a generic search method that restricts the generic type to classes that implement the Comparable interfacefor the generic type. The method should have two parameters, the sorted array to be searched and the item to besearched for, both should be of the generic type. The method should return the index of the target value if foundor -1 if target is not found. The search should stop once the item is found or it is “known” the item is not in thearray.

Create a class that will hold a name, gender, integer index and integer frequency information associated withthat name. The class must also implement the Comparable interface. The comparison should primarily be basedon the names.Write a program which reads the information in the file, converts each line to an object of the type of the classyou created, and stores it into an array (NOT and ArrayList) of objects of the type you created. (There are101,335 names in the file). Sort the array using your sort method. (Note: the sort may take a few minutes to sortthis list, depending on the speed of the computer you are using and the sort method you used.) Allow a user toenter names and have the program search the sorted array for the names using your search method. Use theconsole for I/O, not GUI. When a name is found, the program should display the name and all other informationabout the name (labeled/explained/formatted appropriately), and the index of the name in the sorted array. Ifa name is not found, a message should be displayed indicating the name is not listed. Note: Some names mayappear twice in the file, once for females and another time for males. Make sure your program displaysboth occurrence. Also, the user should be able to use any combination of upper and lower case letters inthe name.




May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here