Can anyone help me fix this exception? The Results coming up but still getting the error. There are four other classes connected to it.
public class CreateLoans {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int num;
int term;
int choice;
String name;
double amount;
Loan[] w = new Loan[5];
for (int i = 0; i < 1; i++) {
System.out.println("Choose Loan Type: 1 Business Loan 2 Personal Loan");
choice = s.nextInt();
if (choice == 1) {
System.out.print("Enter Loan Number: ");
num = s.nextInt();
System.out.print("Enter Last Name: ");
s.nextLine();
name = s.nextLine();
System.out.print("Enter Loan Amount: ");
amount = s.nextDouble();
System.out.print("Enter Number of Terms: ");
term = s.nextInt();
w[i] = new BusinessLoan(num, name, amount, term);
} else if (choice == 2) {
System.out.print("Enter Loan Number: ");
num = s.nextInt();
System.out.print("Enter Last Name: ");
s.nextLine();
name = s.nextLine();
System.out.print("Enter Loan Amount: ");
amount = s.nextDouble();
System.out.print("Enter Number of Terms: ");
term = s.nextInt();
w[i] = new PersonalLoan(num, name, amount, term);
} else {
System.out.println("Error, Please Enter 1 Or 2");
}
}
for (int i = 0; i < w.length; i++) {
System.out.println(w[i].toString());
}
}
}