-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRightTriangleCheck.java
More file actions
27 lines (26 loc) · 1022 Bytes
/
RightTriangleCheck.java
File metadata and controls
27 lines (26 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* Created by fattyduck on 3/24/15.
*/
import java.util.Scanner;
public class RightTriangleCheck{
public static void main(String[] args){
Scanner scan= new Scanner(System.in);
double side1, side2, base;
System.out.println("I will tell you the base of a right triangle");
System.out.println("Side 1 is (height) | of the right triangle and Side 2 is the (hypothenuse) / or \\ of the right Triangle ");
System.out.print("Side 1: ");
side1=scan.nextDouble();
System.out.println();
System.out.print("Side 2: ");
side2=scan.nextDouble();
System.out.println();
while(side1>=side2){
System.out.println("Side2(hypothenuse has to be greater than Side1(Height))");
System.out.println("Try again");
System.out.print("Side 2: ");
side2=scan.nextDouble();
}
base=Math.sqrt((side2*side2)-(side1*side1));
System.out.println("The third side (base is )"+ base);
}
}