You are on page 1of 1

/*

* To change this license header, choose License Headers in Project Properties.


* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ejercicio1;

import javax.swing.JOptionPane;

/**
*
* @author vidal
*/
public class Ejercicio1 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int Long1, Long2;

Long1 = Integer.parseInt(JOptionPane.showInputDialog("La longitud 1"));


Long2 = Integer.parseInt(JOptionPane.showInputDialog("La longitud 2"));
JOptionPane.showMessageDialog(null, "La hipotenusa del triangulo es: " +
hipo(Long1, Long2));}

public static double hipo ( double la, double lb){


double h, hresult;
h = (la * la) + (lb * lb);
hresult = Math.sqrt(h);

return hresult;

}
}

You might also like