| 1. |
First you will create an HTML file for this lab assignment.
Call it lab4.html (See the instructions for Lab 2 if you are unsure how to do this.)
|
| 2. |
For this lab you will design a web page that implements Newton's algorithm for square root approximation.
The algorithm is as follows:
Given a non-negative number N:
- Start with the initial approximation 1.
- As long as the approximation isn't close enough, repeatedly:
- Refine the approximation using the formula:
newApproximation = (oldApproximation + N/oldApproximation)/2.
|
| 3. |
- On your webpage, you will need a text box for the user to input the value of N.
- You will also need a button to calculate the next approximation.
- Finally you will need another textbox to display the current approximation.
This should have an initial value of 1.
- You may optionally add a reset button that sets the value in the N box to the empty string
and sets the value of the current approximation box back to 1.
- Make sure to label each button appropriately and to give your page a title and an explanation of what the page does.
- Here is an example of what your finished web page might look like:
|
| 4. |
When you are done, upload the lab4.html file to the CS server using FileZilla.
(See the instructions for Lab 1 if you are unsure how to do this)
|