2014-09-12T13:13:58-04:00
Java programming.
Given that a Pythagoras theorem is
H2 =b2 +L2
Find h
1
2014-09-12T13:23:31-0400
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 !
Learn more about our help with Assignments:
Java JSP JSF
Comments