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

Exceptions


Instructions

  1. Implement two exception classes, one for overfilling a car's tank and one for trying to drive further than the fuel tank will allow. Throw these exceptions in each of those two situations (throw new ...) and catch them (try ... catch) in your main method. Name these exceptions OverfillTankException and RunningOnFumesException, respectively.
  2. Also write code to handle bad input in your main method. It need not be extensive, but it should cover the basic case of entering garbage input when e.g. an int is expected.

Deliverables

Submit as per the syllabus.