Triangles - triangle"); int s3 =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import javax.swing.JOptionPane; public class Triangles { public static void main(String[] args) { String side1 = JOptionPane.showInputDialog("Enter the first number for the triangle"); int s1 = Integer.parseInt(side1); String side2 = JOptionPane.showInputDialog("Enter the second number for the triangle"); int s2 = Integer.parseInt(side2); String side3 = JOptionPane.showInputDialog("Enter the third number for the
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: triangle"); int s3 = Integer.parseInt(side3); int p = s1 + s2; int sum = s1 + s2 + s3; if(p>s3) JOptionPane.showMessageDialog(null," Side1 = " + s1 + " Side2 = " + s2 + " There sum is = " + p + " Your edges are valid"); else if (p<s3) JOptionPane.showMessageDialog(null,"Your answer is not valid"); System.exit(0); }}...
View Full Document

Ask a homework question - tutors are online