title: Finding the average
body: <p>I got this problem that I need to find the average of total salaries for <code>HourlyEmp</code> ONLY,
  I have a super class <code>Employee</code> and two subs already <code>HourlyEmp</code> and <code>OverTimeEmp</code>
  I named the Array Emp[]. <code>Employee Emp[] = new Employee[7]</code> &lt; 7 items</p>
  
  <p>Now what I need is like ..if I have more than one Employee who's in <code>hourlyEmp</code>
  how to get the average of their salaries?
  So far I got 2 ideas,but non of em is working somehow</p>
  
  <p>1.</p>
  
  <pre><code>'for(int i=0;i&lt;Emp.length;i++) {
        if (Emp[i] instanceof HourlyEmp)
  
    System.err.println("Average="+(Emp[i].totalsal()/i));'
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>double avg=0;
    for(int i=0;i&lt;Emp.length;i++) {
        if (Emp[i] instanceof HourlyEmp)
          avg+=Emp[i].totalsal()/i;
    System.out.println("Average="+avg);
  </code></pre>
  
  <p>I'd appreciate your help :)</p>