From the stack trace, it looks like you're trying to run your program with the appletviewer. But it's not an applet, so that's one part of the problem right there. You need to run your program from the command line using
The only reason you're getting a GUI on screen is because you're setting everything up in the constructor, which would be a no-no for an applet, anyway.
Another problem is that you carefully display the output in the TextArea "displayArea", which isn't displayed on the screen. You've got "resultsField" on the bottom, there, but it isn't used to display anything!
Otherwise, I'm stumped. Sure looks like it should work, and I can't see what could cause those stack traces. Are you sure you're showing us exactly the same code you're running?
I have made a few changes to the RationalTester class, but I have not made any changes to the Rational class. The code is posted below. I really appreciate your assistance. I am getting this stack trace:
The way you've written that event handler now, you are required to hit Enter after making every entry in a text field. If you don't, the values won't be transferred, and you'll have zeroes instead. There's the error you're seeing right there.
Moral of the story: make sure you show people the exact code you're running, or they won't be able to help!
out of the "if", put them into their own method, and call them from each one of the "else"s. There's no need to call it from the "if" but you could if you wanted.
But these lines don't handle the possibility that a text field contains not-a-number, so you're going to see NumberFormatExceptions all over the place. That little method would be a good place to put those handlers.
That's because getGCD() is recursive; it calls itself, and if it never stops calling itself, then the stack will overflow. You need to make sure that the exit condition will always occur -- i.e., that numer % denom always becomes zero (hint -- it clearly doesn't!)
How do I use this to apply it to a sum of two fractions or something similar? I am wanting to be able to let a user input two rational numbers (two numerators and two denominator), and enter the number of decimal places they prefer to see. Then the user can add, subtract, multiply, or divide the two fractions. I have everything working except for this part. I just want to understand how this works. Sorry for all the questions.