CJCoding With Joseph

Sorting With IComparable

The 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:
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.