A good answer might be:No. As is currently stands, the instance variables of all objects cannot be accessed from outside the objects, and there are no access methods to change them. | |
Adding a fillUp() MethodIt would be nice to make the program more useful (and more like the real world) by writing a method for Car that acts like a visit to the filling station. The new method will act like this:
The state of a Car will have to change by changing the values held in its instance variables. The number of gallons of the new fillup will replace the old value, and the odometer readings will have to be adjusted. Here is class Car with some more blanks:
| |
QUESTION 12:Fill in the blanks for the new method. This may think a little bit of thought. Click Here after you have answered the question |