Question: Write a function to calculate the square root of a float number with the following interface: double squareRoot( double x) ll assert that x is

Write a function to calculate the square root of a float number with the following interface: double squareRoot( double x) ll assert that x is not negative The function should return an approximation to vx using series approximation. Let xox/2. Then x+xnx)2. Keep computing terms until the difference between xn and x1 is less than 0.0001. In addition, if the input variable x is negative, your function should stop the execution via the assert) function, which is a built-in C++ function. You need to add a function call to assert() at the beginning of the above function to guarantee the precondition of this function is correct. In your main function, design it to request the user to enter as many numbers as they want (continue to enter values? "y" or "n"). Test cases must include values 3,0, and -3, as well as others you think are appropriate. The specifics of the assert message shown depends on the specific implementation in the compiler, but it should include: the
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
