1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
svetlana [45]
3 years ago
15

Let’s say you are given a number, a, and you want to find its square root. One way to do that is to start with a very rough gues

s about the answer, x0, and then improve the guess using the following formula: x1 = (x0 + a/x0)/2 For example, if we want to find the square root of 9, and we start with x0 = 6, then x1 = (6 + 9/6)/2 = 15/4 = 3.75, which is closer. We can repeat the procedure, using x1 to calculate x2, and so on. In this case, x2 = 3.075 and x3 = 3.00091. So that is converging very quickly on the right answer(which is 3). Write a method called squareRoot that takes a double as a parameter and that returns an approximation of the square root of the parameter, using this technique. You may not use Math.sqrt. In java
Computers and Technology
1 answer:
o-na [289]3 years ago
7 0

Answer:

Check the explanation

Explanation:

package com.squarerrot;

public class SquareRoot {

/**

*

*/

public static double squareRoot(double input) {

System.out.println("Trace for input:" + input);

//random value initialized to 6 here

double output, guessValue = 6, previousValue = 0;

while (input - (output = approximateValue(input, guessValue)) >= 0.00005

&& previousValue != output) {

guessValue = output;

previousValue = output;

System.out.println(output);

}

return output;

}// end of method squareRoot

// calculate the approximate value

public static double approximateValue(double input, double start) {

return (start + (input / start)) / 2;

}// end of method approximateValue

// test the square root method

public static void main(String[] args) {

System.out.println("Square Root of 9:" + squareRoot(9));

System.out.println("Square Root of 16:" + squareRoot(16));

}// end of method main

}// end of the class

You might be interested in
What symbol indicates that a cell is not wide enough to display its numbers ?
Yuki888 [10]

Answer:

Option D is correct. A pound sign is used to indicates that a cell is not wide enough to display its numbers.

Explanation:

A pound sign symbol indicates that a cell is not wide enough to display its number in Excel. However, it is noted that if you use or installed a US keyboard in your computer then hash symbol (#) is shown and the pound sign symbol is shown if you use or installed the UK keyboard layout in your computer.

Why other options are not correct.

  • An Asterisk symbol:

this symbol is used for multiplication in formula or in a cell to multiply the numbers with each other.

  • A dollar sign:

A dollar sign is used in a cell to show the currency. If you want to show the cell value as a currency. Then, you can use the dollar sign.

  • Percentage Sign

Percentage sign in the cell shows that value in a cell is representing a percentage of some values.

3 0
3 years ago
Read 2 more answers
In Java please:
topjm [15]

Answer:

import java.util.Scanner;

public class Supermarket

{

public static void main (String[] args)

{  

String item;

double pounds, ounces, price,

total, unit;

Scanner scn = new Scanner(System.in);

System.out.print("Please enter the name of item ");

item = scn.nextLine();

System.out.print("Please enter the price of "  + "the item per pound : ");

price = scn.nextDouble();

System.out.print("Enter the weight of "  + "the item in pounds and "  + "ounces respectively : ");

pounds = scn.nextDouble();

ounces = scn.nextDouble();

unit = price/16;

total = price * (pounds + ounces/16);

System.out.print("The unit price of "  + "the products sold is : "  + unit);

System.out.print("\nThe total cost of the "  + "amount purchased is : "  + total);

}

}

Explanation:

  • Ask the user to enter the price of  the item and the weight.
  • Calculate the unit and the total price.
  • Display the unit and the total price.

6 0
3 years ago
Read 2 more answers
As the Sunrise hospital implements an EHR, the coding staff requests a new system that will enhance productivity, accuracy, and
Eva8 [605]

Answer:

D. Computer assisted coding

Explanation:

A Computer Assisted Coding System is a software that scans medical documents and generates codes that are appropriately designed for key phrases and terminology in the document. This system is used to enhance productivity, accuracy and efficiency. It can identify when there is a diagnosis of a certain ailment or just used as it is in the family history. It has several advantages over manual coding and even helps identify mistakes made by manual coding.

7 0
3 years ago
Which of the following is not a key component of a structure?
valentina_108 [34]
D. Enumerations! Because I know that is NOT a leg compentent of a structure
5 0
3 years ago
What is the name for the warmth or coolness of white light?
Arturiano [62]

Answer:

white balance is the correct answer

4 0
3 years ago
Other questions:
  • Assign to avg_owls the average owls per zoo. Print avg_owls as an integer. Sample output for inputs: 1 2 4 3
    7·1 answer
  • You can select a paragraph y using the ____key.
    10·1 answer
  • These things are commonly found on the front of desktop computer cases:
    12·1 answer
  • An incorrectly spelled word is indicated by _______. a. a red checkmark beside the word b. the word higlighted in yellow c. a re
    8·2 answers
  • Which describes a design theme in PowerPoint? a set of elements that unify the slides and complement the topic a printed handout
    11·2 answers
  • What is the exposition of the movie inside out
    13·2 answers
  • Choose all items that represent characteristics of HTML attributes.
    5·2 answers
  • What methods do you use when researching a complicated or difficult subject? What tools are most useful to narrowing down and va
    12·1 answer
  • Why is experience in their own factory setting
    13·1 answer
  • The electors in each state shall have the qualifications requisite for electors of the most numerous branch of the state legisla
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!