Assignemnt # and
Code
///Name: Dakota Donahue
///Period: 5
///Project Name:
///File Name:
///Date: 3/10/2016
import java.util.Scanner;
public class RightChecker
{
public static void main( String [] args )
{
Scanner keyboard = new Scanner(System.in);
int s1, s2, s3;
System.out.println(" Enter the sides of a triangle starting from the smallest side and ending with the largest side, and I will determine if the triangle is a right triangle. ");
System.out.println(" Side 1: ");
s1 = keyboard.nextInt();
System.out.println(" Side 2: ");
s2 = keyboard.nextInt();
while ( s1 > s2 )
{
System.out.println(" The side " + s1 + " is larger than " + s2 + ", please enter another number. ");
System.out.println(" Side 3: ");
s3 = keyboard.nextInt();
}
System.out.println(" Side 3: ");
s3 = keyboard.nextInt();
while ( s2 > s3 )
{
System.out.println(" The side " + s2 + " is larger than " + s3 + ", please enter another number. ");
System.out.println(" Side 3: ");
s3 = keyboard.nextInt();
}
Math.sqrt(s1*s1 + s2*s2);
if ( s3 == Math.sqrt(s1*s1 + s2*s2));
{
System.out.println( " A triangle with the sides " + s1 + ", " + s2 + ", and " + s3 + " is a right triangle. " );
}
}
}