
create a Java
The intuitive idea of Newton iteration for computing square roots is fairly straightforward. Suppose you have a guess r for x1/2 that is too large; the argument is similar if it is too small. If r is too large to be the square root of x, then x/r must be too small, so the average of r and x/r should be a better guess than either r or x/r. This suggests that if you repeatedly replace your current guess r by (r + x/r)/2, then your sequence of guesses should converge to x1/2. And indeed it can be proved that it does. A good initial guess for x1/2 is simply r = x. If you continue updating r until |r2 – x |/x < ε2, then the relative error of the guess r will be less than ε.

Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

- This java program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by user specified arrow base height, arrow base width, and arrow head width. (1) Complete the data read in part of the program. Then modify the given program to use a loop to output an arrow base of height arrowBaseHeight. (2) Modify the given program to use a loop to output an arrow base of width arrowBaseWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow base. (3) Modify the given program to use a loop to output an arrowhead of width arrowHeadWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrowhead. (4) Modify the given program to only accept an arrowhead width that is larger than the arrow base width. Use a validation loop to continue prompting the user for an arrowhead…arrow_forwardA patient suffering from asthma needs to keep a diary of their “peak flow” breathingreadings. This is just a number between 0 and 800 measuring how well they canblow air from their lungs. Their peak flow reading is the greatest of three readingstaken at one time. Write a Java procedural program to help the patient record their peak flow to show theirdoctor. The program should first ask the patient for the number their doctor has given themas being a dangerous reading. Any peak flow reading recorded that is less than thedanger level should lead to a message that they need to go to hospital immediately.Once entered, this value should not be changed.After storing this number, the program should go into a loop that only stops whenthey type 0 instead of a day. It should repeatedly ask them for the day of the monthwhich is a number from 1 to 31 (they may skip days) and then the three readingstaken that day. All the peak flow readings (ie the largest of each set of threereadings) should be…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





