35. Add Two Distances

 The class Distance is already defined with a private variable meters, a constructor, and a method getMeters().

Your task is to define the + operator so that two Distance objects can be added.

  • The result should be another Distance object whose meters is the sum of both.
     

Example
 Input:

5 7

Output:

Total=12
Loading...

Input

5 7

Expected Output

Total=12