Question: Java Programming Joyce Farrell, 8th editon exercise 10 pg 486, I need help creating a Gui for the program it works but error keeps getting

Java Programming Joyce Farrell, 8th editon exercise 10 pg 486, I need help creating a Gui for the program it works but error keeps getting thrown, Here is my code, and Output, I need to stop the execption error from appearing:

static int bonus[][] = {{5, 9, 16, 22, 44}, {10, 12, 18, 25, 36}, {20, 25, 32, 42, 53}, {32, 38, 45, 55, 68}, {46, 54, 65, 77, 90}, {60, 72, 84, 96, 120}, {85, 100, 120, 140, 175}}; static int weeks = 6; static int reviews = 4;

private void calcButtonActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: weeks = Integer.parseInt(weeksWorked.getText()); if (weeks > 6) { weeks = 6; } else if(weeks 4) { reviews = 4; } this.outputBox.setText("$" + bonus[weeks][reviews]); }

Java Programming Joyce Farrell, 8th editon exercise 10 pg 486, I need

E8.2 urce Refactor Run Debug Profile Team Iools Window Help Weeks Worked1 Postive Reviews Invalid Number T F age EB multiArrayLecture Java MorgansBonusesjava BPhoneArrayjava ComputerCreationjava @SuppressWarnings ("unchecked") Generated Code 36 37 103 104 105 106 D 107 E 108 D 109 private void calcButtonActionPerformed (java.awt.event.ActionEvent evt) / TOD0 add your handling code here: veeks Integer.parseInt (weeksWorked.getText()); if (veeks6) weeks = 6; 112 113 o 114 if (veeks 4) reviews 4 : run: Exception thread "AT-EventQueue-0" java lang . ArrayIndexOutOfBoundsException: -1 in at MorgansBonuses.calcButtonAction Performed (MorgansBonuses.java: 123) at MorgansBonuses.access$000 (MorgansBonuses.java: 13) at MorgansBonuses$1.actionPerformed (MorgansBonuses.java:56) at javax.swing. AbstractButton.fireActionPerformed (AbstractButton. java:2022)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!