id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > triangleSolve
prev  |  next  |  chance

Write a method that accepts three integer parameters representing a, b, and c (in that order) indicating the sides of a right triangle with hypotenuse c. One (and only one) of the parameters will be a negative number. The negative number is used to indicate which variable is the unknown. Solve for that unknown and return its value as a double.


triangleSolve(5, 3, -1) → 5.830951894845301
triangleSolve(9, 11, -3) → 14.212670403551895
triangleSolve(-6, 70, 71) → 11.874342087037917

...Save, Compile, Run (ctrl-enter)

public double triangleSolve(int a, int b, int c) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 440 Post-solution available

Copyright Nick Parlante 2017 - privacy