CS1150 (Fall 2012, Section 4): Programming Assignment 10

More about objects


  1. Add the following constructors to the Car class. Each should set the car's mileage per gallon to the AVERAGE_MPG constant defined in Assignment 7
  2. Add a method with the signature double fillTank(double amount). This method should have the same behavior as the existing fillTank method, except that the argument is a number of gallons to add to the tank. If the resulting tank level would be greater than 15 gallons, print a message to this effect and don't change the tank level. This is an example of method overloading.
  3. Modify your main method to allow for this functionality. Use helper methods if/when appropriate.


Submit as per the syllabus.