The following Vehicle class throws a custom exception of type IllegalNumberOfWheels. Your task is to implement this exception class. The exception should not be a checked exception, and it should indicate that an improper wheel count is an illegal parameter value.

Complete the following file:

IllegalNumberOfWheels.java

public class IllegalNumberOfWheels // TODO: Inherit from an appropriate exception { /** TODO: Create two constructors: one with no parameters, and one that accepts a message string describing the reason for the exception. */ }

Use the following files:

Checker.java

public class Checker
{
    // This method is used to check your work.
    public static String check(String aType, int numWheels)
    {
       try
       {
          Vehicle aVehicle = new Vehicle(aType, numWheels);
          return aVehicle.toString();
       }
       catch (IllegalArgumentException ex)
       {
          return "IllegalArgumentException: " + ex.getMessage();
       }
       catch (Exception ex)
       {
          return "Exception: " + ex.getMessage();
       }
    }
}

Vehicle.java

/**
   Describes a vehicle with a self-contained propulsion unit.
*/
public class Vehicle
{
    private String type;
    private int wheelCount;
   
    /**
       Constructs a vehicle
       @param aType the type of the vehicle
       @param numWheels the number of wheels on this vehicle
   */
   public Vehicle(String aType, int numWheels)
   {
       if (aType.equals("motorcycle"))
       {
          if (numWheels != 2)
             throw new IllegalNumberOfWheels("Motorcycles need two wheels");
       }
       else if (numWheels < 4)
       {
          throw new IllegalNumberOfWheels();
       }
       type = aType;
       wheelCount = numWheels;
    }

    public String toString()
    {
        return "Vehicle[type=" + type + ",wheelCount=" + wheelCount + "]";
    }
}