Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

//***************************************************** //RightTriangle.java //C

ID: 3620444 • Letter: #

Question

//*****************************************************
//RightTriangle.java
//Compute the length of the hypotenuse of a
//right triangle given the lengths of the sides
//******************************************************

import.java.util.Scanner;
public class static void main (String [] args)
{
double side1, side2; //lengths of the sides of a right triangle
double hypotenuse; // length of the hypotenuse
Scanner scan = new Scanner (System.in);
//Get the lengths of the sides as input
System.out.print ("Please enter the lengths of the two sides of" +
"a right triangle (separate by a blank space): ");
_________________________________________________________;
_________________________________________________________;
//Compute the length of the hypotenuse.
_________________________________________________________;
//Print the result.
System.out.println ("Length of the hypotenuse: " + hypotenuse);
}
}

Explanation / Answer

Dear, Here is the code. import java.util.Scanner; import java.math.*; public class RightTriangle { public static void main (String [] args) { double side1, side2; //lengths of the sides of a right triangle double hypotenuse; // length of the hypotenuse Scanner scan = new Scanner (System.in); //Get the lengths of the sides as input System.out.print("Please enter the lengths of the two sides of" +"a right triangle (separate by a blank space): "); side1=scan.nextInt(); side2=scan.nextInt(); //Compute the length of the hypotenuse. hypotenuse=Math.sqrt((Math.pow(side1,2) +Math.pow(side1,2))); //Print the result. System.out.println ("Length of the hypotenuse:" + hypotenuse); } } Output: Please enter the lengths of the two sides ofa right triangle (separate by a blank space): 3 4 Length of the hypotenuse: 4.242640687119285 Hope this will help you..