Assignemnt #71 Right Triangle Checker
Code
/// Name: JJ Deng
/// Period: 6
/// Program Name: Right Triangle Checker
/// File Name: RightTriCheck.java
/// Date Finished: 1/16/2016
import java.util.Scanner;
public class RightTriCheck
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int side1, side2, side3;
double sum, csquare;
System.out.println("Enter three integers");
System.out.print("Side 1: ");
side1 = keyboard.nextInt();
System.out.print("Side 2: ");
side2 = keyboard.nextInt();
while ( side2 < side1)
{
System.out.println( + side2 + " is smaller than " + side1 + " . Try again.");
System.out.print("Side 2: ");
side2 = keyboard.nextInt();
}
System.out.println("side 3: ");
side3 = keyboard.nextInt();
while ( side3 < side2)
{
System.out.println( + side3 + " is smaller than " + side2 + " . Try again.");
System.out.print("Side 3: ");
side3 = keyboard.nextInt();
}
System.out.println("Your three sides are " + side1 + " " + side2 + " " + side3 + " " );
sum = (side1^ 2) + (side2^ 2);
csquare = (side3^ 2);
if (sum == csquare)
{
System.out.println( " YEPPY SKIPPY.");
}
else
{
System.out.println( " nah brah");
}
}
}
Picture of the output