| about | help | code help+videos | done | prefs |
Complete the function squareRoot that will result in the following solution of isSquareRoot to pass the tests provided. Due to the nature of codingbat, you need to copy the partially-completed template below into the answer box first.
//BEGIN BOILERPLATE/STARTING-POINT
boolean isSquareRoot(double a, double b) {
double root = squareRoot(a);
if(Math.abs(a - b*b) <= a/100.0) {
return true;
}
return false;
}
double squareRoot(int val) {
//to be completed
}
//END BOILERPLATE/STARTING-POINT
isSquareRoot(10.5, 3.24) → true isSquareRoot(1729.6174, 41.58) → true isSquareRoot(10.5, 3.23) → true ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 6 Post-solution available
Copyright Nick Parlante 2017 - privacy