//PythagorasApplet.java import java.awt.*; import javax.swing.*; public class PythagorasApplet extends JApplet { public void init() { String input; double a, b, hypotenuse; input = JOptionPane.showInputDialog( "Enter length of one side of a right triangle" ); a = Double.parseDouble( input ); input = JOptionPane.showInputDialog( "Enter length of other side of a right triangle" ); b = Double.parseDouble( input ); //Math.sqrt(x) argument is number, returns double hypotenuse = Math.sqrt(a*a + b*b); JOptionPane.showMessageDialog(null, "Hypotenuse=" + hypotenuse ); } } /* 3 4 5 6 8 10 1 1 1.41 */