Sorting With IComparable
mediumQuestion 705The Book class implements IComparable<Book>. Complete CompareTo so books order by their Pages (fewest first). The tester calls Array.Sort and prints each book's title and pages. Do NOT write a Main method.
For books with 300, 100 and 200 pages (titles B, A, C) the sorted program prints the output shown in Expected Output.
Expected output
A 100 C 200 B 300
= newline. The output ends with a newline, so print one after the last line.
Hints2 available
Sign in to use hintsTopics
Interfaces
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.