CPTR-142 Homework #5 - Due Wednesday 4/16/14
Write a program in which a class called Odometer is defined.
This class will be used to track fuel and mileage for a vehicle.
Include private member variables to track miles driven and
gallons of fuel used. The class should have a default constructor
that initializes miles and gallons to zero. There should be
member functions to reset the odometer and gallons to zero,
a member function that accepts miles driven for a trip and adds
it to the odometer's total, a member function that accepts gallons
used and adds it to the total gallons, and a member function
that returns the miles-per-gallon since the odometer was last
reset. This will be called program 5.
Write a main that will declare two or more odometer objects
(presumably representing two or more vehicles),
puts data into them, calls to get the mileage (miles-per-gallon) for each
vehicle, and displays mileage for each vehicle.
Bring a printout of your main.cpp
file to class. Email the main.cpp files to
me but as you do that change the name to: name_program5.cpp
where name represents your last name. And between name and
program5 is an underscore. I appreciate not having spaces
in your file names.
Larry Aamodt PhD, PE
Professor of Engineering and Computer Science
Walla Walla University
Contact:
via email: AamoLa (at) wallawalla.edu
via phone: x2058