FRACTION APPLET

You will write an applet which takes a fraction as input in a SINGLE input textfield. The user will use / to create a fraction. Typical input might be something like: 9/15. The user will then simply hit the return key and the input will be reduced if reduction is possible (in the case of the example used in the previous sentence, 3/5 would be appropriate output). If the input is not a fraction then the applet will indicate this to be the case.

*******************

Your applet will use an instance of a user defined class called fraction. You may model your fraction class after those found in the seventh grade math course pages if you wish. The key algorithm which you will need to use is shown in the textarea below. There are less efficient ways of finding the Greatest Common Divisor, but you might as well do it the right way, so use this one!

Euclid's Algorithm

One of the challenges you will face in creating this applet is figuring out how you will take input such as 5/20 and assign 5 to a variable representing the numerator and 20 to a variable representing the denominator. You may need to do some research to figure this one out. Returning the correct answer to the user, isn't nearly as difficult.

The other slight difficulty has to do with using the return key within the text area to trigger events. It's not really all that bad though. It's pretty straight forward.