Question: You are provided with some sample code for searching/sorting algorithms, which are currently based on integer arrays. However, you are tasked to utilize a custom
You are provided with some sample code for searching/sorting algorithms, which are currently based on integer arrays. However, you are tasked to utilize a custom class that will implement comparable and represents CDs. Each CD has an artist, title, serial number, and price. You decide they should be sorted by serial number.
After careful consideration, you also decide to employ ArrayLists instead of the current integer arrays in make the search routines more generally applicable. Given your previous experience with Generics, you finally decide that you should implement the search and sort algorithms by utilizing comparable generics.
Create your program and create a test case that showcases its functionality for each search/sort.
Step by Step Solution
3.37 Rating (150 Votes )
There are 3 Steps involved in it
To tackle this challenge lets break it down into several steps Step 1 Define the CD Class First well define a CD class that implements the Comparable interface This will allow us to sort CDs by their ... View full answer
Get step-by-step solutions from verified subject matter experts
