subject

Your first job is to create a java program that repeatedly asks the user whether they wish to calculate another square root. if the response is "y", then the program should proceed; if it is anything else, then the program should quit. whenever it proceeds, the program should prompt the user for a number (a positive double, and your program may simply assume the input is consistent with this requirement) and then report the square root of that number to within a relative error of no more than 0.01%. the computation must be done using newton iteration. 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 îµ. after your initial program works, there are a number of other requirements to change it slightly, one step at a time, as explained below.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 16:10
Which is a benefit of peer-to-peer networking? easy to add or remove devices main server has a fast processor more reliable than a client/server network same software versions on all computers
Answers: 3
question
Computers and Technology, 23.06.2019 10:20
Suppose there is a relation r(a, b, c) with a b+-tree index with search keys (a, b).1. what is the worst-case cost of finding records satisfying 10 < a < 50 using this index, in terms of the number of records n1, retrieved and the height h of the tree? 2. what is the worst-case cost of finding records satisfying 10 < a < 50 and 5 < b < 10 using this index, in terms of the number of records n2 that satisfy this selection, as well as n1 and h defined above? 3. under what conditions on n1 and n2, would the index be an efficient way of finding records satisfying the condition from part (2)?
Answers: 1
question
Computers and Technology, 23.06.2019 11:20
Http is the protocol that governs communications between web servers and web clients (i.e. browsers). part of the protocol includes a status code returned by the server to tell the browser the status of its most recent page request. some of the codes and their meanings are listed below: 200, ok (fulfilled)403, forbidden404, not found500, server errorgiven an int variable status, write a switch statement that prints out the appropriate label from the above list based on status.
Answers: 2
question
Computers and Technology, 23.06.2019 19:30
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a,b] se pot scrie ca produs de două numere prime? “.
Answers: 3
You know the right answer?
Your first job is to create a java program that repeatedly asks the user whether they wish to calcul...
Questions
question
Mathematics, 23.07.2020 05:01
Questions on the website: 13722362