A terminal-based program that uses Newton’s method to compute square roots is described in Chapter 3. Recast this program as a GUI-based program. The user should be able to view successive approximations by clicking a command button
The interface should have two labeled entry fields, one for the input number and the other for the output of the square root. The interface should include two command buttons. A button labeled Estimate should compute and display the next guess based on the previous one. A button labeled Reset should set the input and output fields to 0.0. At start-up and after each reset, the program’s initial guess should be 0.0. If the program’s initial guess is 0.0 and the user’s input is greater than 0.0, the program’s first guess should be set to the input divided by 2.0. Otherwise, the program’s new guess should be set using Newton’s approximation formula.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here