As you can see from the photos
if a side is a single value digit, then the "hypotenuse" tests won't match. How can I make it so that regardless of whether the sides are one or two value digits, the text of output will match?
Only looking to use beginner-ish statements.
public class PyTheorem {
public static void main(String[] args) {
double x = 5 + (Math.random() * (23-1)); //generates random number between 5 and 22 for side x of triangle 1
double y = 5 + (Math.random() * (23-1)); //generates random number between 5 and 22 for side y of triangle 1
double q = 5 + (Math.random() * (23-1)); //generates random number between 5 and 22 for side q of triangle 2
double r = 5 + (Math.random() * (23-1)); //generates random number between 5 and 22 for side r of triangle 2
int a = (int)(x); //a inherits the value of side x in an integer form
int b = (int)(y); //b inherits the value of side y in an integer form
int c = (int)(q); //c inherits the value of side q in an integer form
int d = (int)(r); //d inherits the value of side r in an integer form
double hyp1 = Math.sqrt(Math.pow(a,2) + Math.pow(b,2)); //finds hypotenuse for triangle 1
double hyp2 = Math.sqrt(Math.pow(c,2) + Math.pow(d,2)); //finds hypotenuse for triangle 2
System.out.print("Triangle 1 Side 1: " + a);
System.out.println(" Side 2: " + b + " Hypotenuse: " + hyp1);
System.out.println("Triangle 2 Side 1: " + c + " Side 2: " + d + " Hypotenuse: " + hyp2);
}
}