โ Back to Classes
Question 437
Odometer Class
Odometer Class
Create a classOdometerwith a public double fieldMiles(starts at 0) and anAddTrip(double distance)method that adds the trip distance ontoMiles. Do not write aMainmethod. After trips of 12.5 and 7.5 the program prints: 20
Expected Output:
20
Topics:
Classes
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.