Hello,
I have 2 classes, Employee, and EmployeeProgram. I keep getting a NullPointerException Error from two of my lines in my main method in EmployeeProgram. I highligted the lines below in green as well, but the lines i'm getting the errors from are:
double[] monthlyPay = computeMonthlyPay(employees); And
switch(employees[i].employeeType){

I am fairly new to java program and have already asked my TA and professor to no avail. If anyone could help me shed some light on this that would be great.

the assignment was to write a public class Employee with String fields name, address, employeeType (possible types are H for Hourly, S for Salary, M for Management), ssn, and a double field monthlyPay.
An Hourly Employee has two additional double fields – hourlyRate and hoursWorked. A Salary Employee
has one double field – annualSalary. A Management Employee has two double fields – regularSalary and
bonus.
Then give Employee three constructors – one appropriate to initialize the fields for an Hourly Employee, another
appropriate for a Salary Employee, and the third appropriate for a Management Employee. In main,
initialize field values for 3 of each type of Employee (Hourly, Salary, Management) into a 9-dimensional array for each field. Now, inside a for-loop, use an appropriate switch statement to select the correct constructor (based on
employeeType) to instantiate a 9-dimensional Employee object array.
Write a computePay() method for each of the 3 Employee types. Write a
second for-loop to call computeMonthlyPay() for each of the 9 Employees, and print out the Employee
name and monthlyPay.


here is my Employee class

public class Employee{

public String name;
public String address;
public char employeeType;
public String ssn;
public double monthlyPay;
public double parameter1;
public double parameter2;

public Employee(String n, String a, char eT, String ss, double p1, double p2){
this.name = n;
this.address = a;
this.employeeType = eT;
this.ssn = ss;
this.parameter1 = p1;
this.parameter2 = p2;
}
public Employee()
{}
public Employee(String n, String a, char eT, String ss, double p1){
this(n, a, eT, ss, p1, 0);
}
public Employee(double p1, double p2, String n, String a, char eT, String ss){
this(n, a, eT, ss, p1, p2);
}
public static double computePay(double hourlyRate, double hoursWorked){

double pay = hoursWorked * hourlyRate;

return pay;
}
public static double computePay(double annualSalary){
double pay = annualSalary/12;

return pay;
}
public static double computePay(double regularSalary, double bonus, int x){
double pay = bonus + (regularSalary/12);
return pay;
}
}


Here is my EmployeeProgram class

public class EmployeeProgram extends Employee{
public static void main(String[] args){
String[] n = {"Pete Za", "Pepe Roni", "Mary Nara", "Buff Alo", "Frank Pucinni", "Alfred Oh", "Michael Jackson", "Jack Johnson", "Beyonce"};
String[] a ={"21 Italian ln", "42 Pizza st", "116 Shulze Hall", "14 Oak Street", "17 Safety Dance st", "81 Victory Lap", "42 Thriller St", "13 Hawaii Rd", "33 Single Ladies Ln"};
char[] eT = {'h', 'h', 'h', 's', 's', 's', 'm', 'm', 'm'};
String[] ss = {"131451834", "164278937", "893456723", "673567845", "44226633", "78562395", "23436512", "564782345", "45458749"};
double[] p1 ={8.00, 8.00, 8.00, 53760, 53760, 53760, 67200, 67200, 67200};
double[] p2 ={40, 40, 40, 0, 0, 0, 40, 40, 40};
Employee [] employees = new Employee[9];

for(int i = 0; i < 9; i++){

switch(eT[i]){
case'h':
employees[i] = new Employee(n[i], a[i], eT[i], ss[i], p1[i], p2[i]);
break;
case's':
employees[i] = new Employee(n[i], a[i], eT[i], ss[i], p1[i]);
break;
case'm':
employees[i] = new Employee(p1[i], p2[i], n[i], a[i], eT[i], ss[i]);
break;
default:
System.out.println("Invalid Employee Type");

}
double[] monthlyPay = computeMonthlyPay(employees);
for(int j = 0; j < 9; j++){
System.out.println(n[j] + " " + monthlyPay[j]);
}
}

}
public static double[] computeMonthlyPay(Employee[] employees){
double[] monthlyPay = new double[9];
for(int i = 0; i < 9; i++){
switch(employees[i].employeeType){
case'h':
monthlyPay[i] = computePay(employees[i].parameter1, employees[i].parameter2);
break;
case's':
monthlyPay[i] = computePay(employees[i].parameter1);

break;
case'm':
monthlyPay[i] = computePay(employees[i].parameter1, employees[i].parameter2, 1);
break;
default:
System.out.println("Invalid Employee Type");

}
}
return monthlyPay;
}
}


I'm sorry this is such a long post but I didn't know where else to go for help after asking my TA and my professor.