CJCoding With Joseph
15free / daySign inCreate account

You are tracking total distance across multiple runs.

Create a class Distance that stores TWO ints: kilometers and meters. - meters should always be 0..999 (normalize after operations).

Requirements: 1) Constructor Distance(int kilometers, int meters) 2) int getMeters() const (return TOTAL meters) 3) operator+= adds another Distance to this one and returns *this 4) operator+ returns a NEW Distance using operator+= internally

Do NOT write a main function.

Expected output

350
15

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

Hints4 available
Topics
ClassesOperator Overloading
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.