Euclid - Sample Java applet

by Gavin Wraith

Euclid is an example of a Java applet. It demonstrates the use of the Euclidean Algorithm to find the highest common factor of two numbers.

In order to run the applet, you will need a Java Virtual Machine such as Acorn's RISCaf or Peter Naulls' Chockcino. Alternatively, you can use the files on another platform for which a JVM is available.

Running the item opens an archive containing three files. Euclid/html is an HTML file that describes the use of the Euclidean Algorithm, and which includes the code to run the embedded Java applet. The other two files are Java class files that make up the applet. Provided you have a Web browser that understands the <APPLET> tag, and a JVM as described above, double-clicking on the Euclid/html file will load it into your browser and display the applet at the bottom of the page.

The applet should display two input boxes, into which you type the two values for which you wish to find the highest common factor, and a button labelled Go. Clicking on this button opens a small window which displays the results of the calculation.

Please note that the three files must be stored together in the same directory. You can run them directly from this disc, or transfer them to another filing system if you prefer.

Copyright  RISC User magazine 1998
