60 342
Assignments Done
98%
Successfully Done
In April 2018

Answer to Question #46279 in Java | JSP | JSF for Fel

Question #46279
Java programming.

Given that a Pythagoras theorem is

H2 =b2 +L2

Find h
Expert's answer
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Pythagore {
public static void main(String[] args) {
BufferedReader buffRead = new BufferedReader(new InputStreamReader(System.in));
double cat1 = 0, cat2 = 0;

System.out.print("The first cathetus: ");
try {
cat1 = Double.parseDouble(buffRead.readLine());
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
System.out.print("The second cathetus: ");
try {
cat2 = Double.parseDouble(buffRead.readLine());
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

System.out.println("The hypotenuse equals " + Math.sqrt(cat1*cat1 + cat2*cat2));
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions