โ Back to Interfaces
Question 615
Sorting With IComparable
Sorting With IComparable
TheBookclass implementsIComparable<Book>. CompleteCompareToso books order by theirPages(fewest first). The tester callsArray.Sortand prints each book's title and pages. Do NOT write aMainmethod. For books with 300, 100 and 200 pages (titles B, A, C) the sorted program prints: A 100 C 200 B 300
Expected Output:
A 100 C 200 B 300
Topics:
Interfaces
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.