CJCoding With Joseph
15free / daySign inCreate account

Car Odometer

A Car stores its make, an odometer reading in km and a trips count that starts at 0. Write the body of drive so one call adds km to the odometer and adds one to the trip count; nothing is returned. Do NOT write a main block or any top-level test code; the tests construct the class. Input: one line, the distance of the trip, which the tests read as a float and pass to drive on a car whose odometer starts at 1200.0; the tests then print the odometer and the trip count on separate lines.

Expected Output:

1255.5
1

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
Classes
📥 Auto-Input:
55.5\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.