Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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]); }image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions