//Package PS1 import javax.swing.JOptionPane; public class Triangle { public static void main(String args[]) { //ask user to enter three positive integers int a = Integer.parseInt(JOptionPane.showInputDialog("Enter the length of the first edge:")); int b = Integer.parseInt(JOptionPane.showInputDialog("Enter the length of the second edge:")); int c = Integer.parseInt(JOptionPane.showInputDialog("Enter the length of the third edge:")); int max = Math.max(a, Math.max(b, c)); if((max==a && a*a==b*b+c*c)||(max==b && b*b==a*a+c*c)||(max==c && c*c==a*a+b*b)) System.out.println("Great, they can make a perpendicular triangle!"); //JOptionPane.showMessageDialog(null,"Great, they can make a perpendicular triangle"); else System.out.println("Sorry, they can't make a perpendicular triangle."); //JOptionPane.showMessageDialog(null,"Sorry, they can't make a perpendicular triangle"); System.exit(0); } }