CPTR-142 Homework #7 - Due Wednesday 4/23/14
In program 5 an Odometer class was defined that can be used to
keep track of fuel and mileage for a vehicle. In program 6 functions
were added to: 1)determine the difference in gas mileage between two
vehicles (i.e. subtraction) and 2) determine if
one vehicle's mileage is greater than another and return a bool type
result.
Now for program 7 extend the functions available in the Odometer class
to include functions that overload operators for stream input (the >> operator)
and stream output (the << operator). Follow the syntax used in
the example program for Fractions that we looked at in class. This
program is posted on the class website.
Write a main that will declare two or more vehicles (i.e. objects
of type Odometer), put data into them by using cin with the
overloaded input operator and then display the full & mileage for
vehicles using the overloaded output operator.
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_program7.cpp
where name represents your last name. And between name and
program7 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