Monotonic Odometer
mediumQuestion 582The 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 (see Expected Output).
Setting 100 then 150 updates the reading to: 150
Expected output
100= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
Encapsulation
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.