CJCoding With Joseph

Monotonic Odometer

The Odometer class has a private field miles. A real odometer can never run backward. Add a Miles property whose setter stores value only when it is greater than or equal to the current miles; smaller values are ignored. Do NOT write a Main method.

Setting 100 then 50 keeps the reading at:
100

Setting 100 then 150 updates the reading to:
150

Expected Output:

100
Topics:
Encapsulation
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.