Assignment 75; RightTri

Code

// Donovan Rich
// Period 6
// Right Triangle Checker
// RightTri.java
// 1/28/2016

import java.util.Scanner;

public class RightTri
{
	public static void main( String[] args )
	{
		Scanner keyboard = new Scanner(System.in);
        int s1, s2, s3;
        
        System.out.println( "Choose three integers." );
        do
        {
            System.out.print( "\nSide 1 =>  " );
            s1 = keyboard.nextInt();
            if ( s1 < 1 )
                System.out.print( "  " );
        } while ( s1 < 1 );
        
        do
        {
            System.out.print( "\nSide 2 =>  " );
            s2 = keyboard.nextInt();
            if ( s2 < 1 )
                System.out.print( "  " );
        } while ( s2 < 1 );
        
        do
        {
            System.out.print( "\nSide 3(Hypotenuse) =>  " );
            s3 = keyboard.nextInt();
            if ( s3 > s1+s2 )
                System.out.print( "  " );
            else if ( s3 < Math.abs(s1-s2) )
                System.out.print( "  " );
        } while ( s3 > s1+s2 || s3 < Math.abs(s1-s2)  );
        
        System.out.println( "Calculating: triangle with side lengths of " + s1 );
        System.out.println( " and " + s2 + " and a hypotenuse of " + s3 + "..." );
        if ( s3*s3 == ( s1*s1 + s2*s2 ) )
        {
            System.out.println( "This triangle is a right triangle." );
        }
        else
        {
            System.out.println( "This is not a right triangle.");
        }
    }
}
            
        
        

        

Picture of the output