title: payroll : adding multiple array values
body: <p>The question is to create a program that asks the user to input how many employees. Then with each employee, a name, hour pay rate, hours worked is entered. the results of the employee pay, overtime pay and total pay is calculated.</p>
  
  <p>My dilemma is how to find the total of all the pays. all employees pay, all employees overtime pay and all employees total pay</p>
  
  <p>ex. user input: 2 employees (creates two arrays)
  two inputs(name, rate, hours worked) will be entered<br>
  two results (pay, overtime pay, total pay) will be calculated
  how do you add the pays, the overtime pays and total pays from both employees?</p>
  
  <p>this is the code ive come up with, but it needs work</p>
  
  <p>import java.util.Scanner;</p>
  
  <pre><code>public class paycheck {
     public static void main(String[] args)
     {
  
         Scanner input= new Scanner(System.in);
          System.out.print("Enter number of Employees: ");
          int numberOfEmp= input.nextInt();
  
          int[] arrayList= new int[numberOfEmp];
           for (int i = 0; i &lt; arrayList.length; i++){
  
          System.out.print("Enter Employee Name: ");
          String empName= input.next();
  
          System.out.print("Enter hourly rate: ");
          int rate= input.nextInt();
  
          System.out.print("Enter hours worked: ");  
          int hours=input.nextInt();
  
         if (hours &gt;=40)
     {
         double regPay=  hours * rate;
         double otPay = (hours-40) *(rate*1.5);
         double totalPay= regPay + otPay;
         System.out.print("\nEmployee name: " + empName+"\n Regular pay: " + regPay +"\n Overtime pay: " + otPay+ "\n Total pay: " + totalPay+ "\n"+ "\n");
     }
  
          else
     {
         double regPay=  hours * rate;
         double otPay =0;
         double totalPay= regPay + otPay;
         System.out.print("\nEmployee name: " + empName+ "\n Regular pay: " + regPay +"\n Overtime pay: " + otPay+ "\n Total pay: " + totalPay+ "\n"+ "\n");
      }
  
      }
     }
  }
  </code></pre>