Question: PLEASE USE JAVA Lab Exercise 06.3 Square Root This exercise is intended to give you experience with throwing and handling exceptions. The job will be

PLEASE USE JAVA
 PLEASE USE JAVA Lab Exercise 06.3 Square Root This exercise is

Lab Exercise 06.3 Square Root This exercise is intended to give you experience with throwing and handling exceptions. The job will be to calculate the approximate square root of a number. Th "sqrt)" method and will display the answers. The "sqrt)"method will be written using the algorithm as follows: e main program will generate calls to the The approximate square root may be calculated by repeatedly performing a calculation, using the following formula; nextGuess (previousGuess(num/ previousGuess))/2 When nextGuess and previousGuess are almost identical, nextGuess is the required square root. The previousGuess to start may be any positive value After each calculation you will compare nextGuess and previousGuess and if the difference is less than a nextGuess is the approximate square root of num. If not, then the value of nextGuess is copied to previousGuess and the calculation is done again. Testing If an invalid (negative) argument is sent to the square root method, IllegalArgumentException. Catch this exception in your main method, inform the user of the specific cause of the error and allow the user to try again. your program should throw an Invalid arguments Negative numbers

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!