CJCoding With Joseph
15per day

Book Progress (operator-= and operator>=)

You are tracking reading progress using current page and total pages.

Create a class ReadingProgress that stores TWO ints: currentPage and totalPages.
Pages left = totalPages - currentPage.

Requirements:
1) Constructor ReadingProgress(int currentPage, int totalPages)
2) int getPagesLeft() const
3) operator-=(int pagesRead) increases currentPage by pagesRead (do not exceed totalPages) and returns *this
4) operator>=(int pages) returns true if pagesLeft >= pages

Do NOT write a main function.

Expected Output:

60 true
10 false
Topics:
ClassesOperator Overloading
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.