title: How to implement a custom exception?
body: <p>This is my overTime excepton to print message if sales target isn't meet.</p>
  
  <pre><code>public class OverTimeException extends Exception {
  
          int salesTarget;
          public OverTimeException(int s) {
              salesTarget = s;
          }
          String myPrint()
          {
  
              return "exception caught because sales target is " + salesTarget; 
  
  
          }
      }
  </code></pre>
  
  <p>This is the Clerk class that I want to use the exception in salesTarget method.My question is how do I implement the exception into the salesTarget method?Thanks</p>
  
  <pre><code>public class Clerk extends Admin implements ClerkInterface {
  
      final double payRate = 13.00;
      final int salesTargetNum = 46;
  
  
      //Member variables
      private double unitSold;
  
      //Constructor
      public Clerk(String inName, String inId, double inHoursWorked,
              double intkPay, double inAdmin_quota,double inUnitSold) {
          super(inName, inId, inHoursWorked, intkPay, inAdmin_quota);
  
          setUnitSold(inUnitSold);
  
      }
  
  
      //setUnitsSold method
      private void setUnitSold(double inUnitSold) {
          unitSold = inUnitSold;
  
      }
  
  
      //getUnitsSold
      public double getUnitsSold(){
  
          return unitSold;
      }
  
  
  
  
  
      //toString method
      public String toString()
      {
          return " " + super.toString() + "Admin Quota " + getAdmin_quota() + "Units Sold" + getUnitsSold();
  
  
      }
  
  
      //method to confirm sales targets are made from ClerkInterface.
      public void salesTarget() {
  
          if(salesTargetNum &gt;= unitSold){
  
              System.out.println("Clerk has not meet sales target");
          }
          else
          {
              System.out.println("Clerk has meet sales target");
          }
  
      }
  
  
  
  
  
      }//end Clerk
  </code></pre>