Jeff Verdegan wrote:I'd still like you to tell me what's on the lines of code indicated in this stack trace (if you haven't changed things so that those line numbers no longer apply):
Brandon Buchanan wrote:
Jeff Verdegan wrote:Do you know what the void means there? Do you know how to return a value from a method?
To be honest, I don't FULLY understand it.
Brandon Buchanan wrote:
Jeff Verdegan wrote:In this case, though, I'm going to guess that you only changed that, but did not change your getInterestRates() method.
OK, I made that change as well and here are the errors that I get:
Jeff Verdegan wrote:Do you know what the void means there? Do you know how to return a value from a method?
Brandon Buchanan wrote:
Jeff Verdegan wrote:I'd still like you to tell me what's on the lines of code indicated in this stack trace (if you haven't changed things so that those line numbers no longer apply):
Line 201: monthlyInterest = (interest[termList.getSelectedIndex()] / (12 * 100));
Line 19: public class PaymentCalculatorWeek5 extends JPanel {
Line 64: button1ActionPerformed(evt);
Jeff Verdegan wrote:Okay, the anonymous inner class makes this a bit confusing, but basically, other than it's reference to the beginning of the class, the stack trace tells us, from the bottom up, what called what at which line of code. Ultimately, at the top, line 201, we see that we're doing monthlyInterest = (interest[termList.getSelectedIndex()] / (12 * 100));, and this is where the error occurred. Looking at this line, we can see that either interest or temrList must be null, (or possibly interest[termList.getSelectedIndex()], if interest is Double[] rather than double[]).
Brandon Buchanan wrote:
Jeff Verdegan wrote:Okay, the anonymous inner class makes this a bit confusing, but basically, other than it's reference to the beginning of the class, the stack trace tells us, from the bottom up, what called what at which line of code. Ultimately, at the top, line 201, we see that we're doing monthlyInterest = (interest[termList.getSelectedIndex()] / (12 * 100));, and this is where the error occurred. Looking at this line, we can see that either interest or temrList must be null, (or possibly interest[termList.getSelectedIndex()], if interest is Double[] rather than double[]).
Well termList is not Null because I hardcode those values into the drop down box here:
So I am thinking that those values are never reaching the main interest array that I declare at the beginning. It seems to me that it could be a placement problem, like where I am reading the file, and that it's not able to access it in other places, is that what you are thinking?
Jeff Verdegan wrote:I think we already found the source of the problem, and you're already on your way to fixing it--namely to return a double[] from getInterestRates() and assign that to your interest variable. (Not sure if I have the names right, but you know what I mean, I hope.) This stuff was to help you learn how to use the stack trace to find the source of the problem (and to confirm our hunch, which it has pretty much done).
Don't get me started about those stupid light bulbs. |