Extra Credit!

When discussing inheritance we used the following classes that largely build on lab 3:
VendingMachine.java
IceCreamMachine.java
(VendingMachineTest.java)

Method fillUp is not designed well:  When calling fillUp(int,boolean) for an IceCreamMachine object, the method in class VendingMachine is called.  This means that the variable coolingOk is not set as it would be for fillup(int).  One way to solve this problem would be to override fillUp(int,boolean) in class IceCreamMachine by supplying a method that handles the check on maxFillup properly.

As an exercise in understanding overloading, overriding, and polymorphism you can gain 10 points extra credit by implementing the methods fillUp(int) and fillUp(int,boolean) in VendingMachine, such that with one of the two methods (fillUp(int) and fillUp(int,boolean)) alone in IceCreamMachine, both the check on maxFillup and the decision depending on removeTokens are handled properly.  You have to explain your code to me in person (during office hours, labs or after a lecture) to gain the extra credit.

Note: