Assignemnt #75
Code
/// Name: Daniel Nguyen
/// Period: 6
/// Program Name: rtc Program
/// File Name: rtc.java
/// Date Finished: 9/9/2015
import java.util.Scanner;
public class rtc
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int side1 = 0;
int side2 = 0;
int side3 = 0;
System.out.println("Enter 3 intergers:");
do {
System.out.print("Side 1: ");
side1 = keyboard.nextInt();
if (side1 <= 0) {
System.out.println("Pick a positive number that isn't zero");
}
} while (side1 <= 0);
do {
System.out.print("Side 2: ");
side2 = keyboard.nextInt();
if (side2 < side1) {
System.out.println("Pick a number larger than " + side1);
side2 = side1 + 1;
}
} while (side2 < side1);
do {
System.out.print("Side 3: ");
side3 = keyboard.nextInt();
if (side3 < side2){
System.out.println("Pick a number larger than " + side2);
side3 = side2 + 1;
}
} while (side3 < side2);
int wobble = 0;
do {
wobble = side3*side3;
wobble = (side1*side1) + (side2*side2);
if (wobble == side3) {
System.out.println("You made a right triangle! YAY!");
}
else {
System.out.println("You didn't make a triangle........");
}
wobble = 1;
} while (wobble != 1);
}
}
Picture of the output