Question: Consider this Book class. Book title : String - year: int + Book (title: String, year: int) + getTitle () : String + getYear()

Consider this Book class. Book title : String - year: int + Book (title: String, year: int) + getTitle () : String + getYear() : int + setTitle (title : String ) : void + setYear( year: int ) : void + equals ( obj : Object ) : boolean + compareTo ( b: Book ) : int Convert the insertionSort () method so it will sort Books instead of ints. Hint: Only 3 lines require changes. Submit your answer by copying the entire method with changes to the appropriate lines. public static void insertionSort (int[] data, int N) { for (int i = 1; i < N; i++) { int element = int j = = i; data[i]; // shift elements to the right as long as // they are greater than element for (j = i; j > 0 && data[j-1] > element ; j--) data[j] = data[j-1]; // insert the data element data[j] = element; }
Step by Step Solution
3.41 Rating (151 Votes )
There are 3 Steps involved in it
To convert the insertionSort method to sort Book objects instead of ints you need to make ... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (2 attachments)
663df4dd52de7_960778.pdf
180 KBs PDF File
663df4dd52de7_960778.docx
120 KBs Word File
