An application tracks the amount that account owed for tolling charges. These charges are accrued when crossing a bridge. There are 3 types of accounts: one for cars, one for trucks and one for emergency vehicles. Cars have a person owner with a first and last name, a license plate, and an account number. When a car crossed a bridge the charge is $5. Trucks have a corporation owner, a license plate, and an account number. When a truck crosses the bridge, it is charged $3 per axle. Emergency vehicles are also in the system, but cross the bridge for free. These emergency vehicles have a government owner, an account number and a license plate.
Make classes for all types of vehicles, with all properties mentioned, using inheritance when possible. Each class should have a method that can be called when the vehicle crosses the bridge. The method should keep track of how much the account owes.
In addition to the classes, write some code in a main method that creates some vehicles, post some tolls and prints out their account balance. Your main method code should verify that the method called for each crossing accurately keeps the account balance.