title: Does this use the Factory design pattern? (java)
body: <p>I'm writing a small program in Java for an assignment in a OOAD class and I have a problem understanding exactly what constitutes a proper factory design pattern and how to implement it in my program.</p>
  
  <p>It's a small program for payroll calculation. There is a base class called Employee and three derived (sub) classes called Hourly, Commissioned and Salaried. They each have different types of data types for payments. I'm only allowed to instantiate one object in the main class, and in the whole program. Through Polymorphism the objects should be shared between classes and I am to write a Factory method to create the objects to be assigned to THE Object.</p>
  
  <p>I have the base class:</p>
  
  <pre><code>public class Employee {
  
  protected Employee empFactory(int empType){
      if (empType == 1)
          return new Hourly();
      if (empType == 2)
          return new Commissioned();
      if (empType == 3)
          return new Salaried();
      else
          return null;
  }
  
  public static void main(String[] args) {
      // TODO code application logic here
  }
  </code></pre>
  
  <p>And three derived classes:</p>
  
  <pre><code>public class Commissioned extends Employee
  public class Hourly extends Employee
  public class Salaried extends Employee
  </code></pre>
  
  <p>I've left out some of the datatypes and other details, I think this should be enough info. Is the factory method I have a "real" one? I've been reading about abstract and concrete factory methods and concrete products etc, but I'm still confused, don't know how to implement it. Any help or pointers would be greatly appreciated!</p>