Question: Write a method that will take in a double as a parameter and will return the square root of the number. However, if the number

Write a method that will take in a double as a parameter and will return the square root of the number. However, if the number is negative, throw an exception with the message "Error. Cannot find the square root of a negative number." (Recall that there is a method called Math.sqrt(). You do not have to write your own square root method.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!