Assignment 3: You are going to build two versions of a Square Root calculator.

Stat 1129 Fall 2011 Name(s)Assignment 3: You are going to build two versions of a Square Root calculator. These calculators are to accept from your user a Real (Floating Point) Number to find the square root of, and a second Real number to specify the desired accuracy of the square root. That is, the square root calculation terminates when the absolute difference between 1.0 and the ratio of two successive converging (square) roots is less than the desired accuracy. Why two versions? Use the WHILE DO  iteration construct for one; and the REPEAT UNTIL  construct for the other. Most of the code of the two event handlers will be identicalespecially the exception (error) handling. So, program one, and mostly copy / paste for the second one. Each of the two calculators should display a) The intermediate converging roots during the calculation (in two ListBoxes), b) The calculated square root, c) The number of iterations necessary to achieve the desired accuracy for each square root, and d) The result of the built-in Delphi SQRT function. For example, find the square root of 1235.0 to 0.001 accuracy: The results might be a) Square root: 35.1412345 b) Iterations: 9 c) Delphi value: 35.1425667816 d) perhaps roughly the following lists of values: List1: 618.0~300.0~150.0 ~80.0 ~50.0~37.00 ~35.19 ~35.15 List2:~2.0~4.0~7.0~15.0~24.0~33.38 ~35.10~35.14 The expected program consists of a) Two labeled TEdit components for the user to enter the number and the required accuracy, b) Some method to determine which square root version to use, and c) Several display components (TEdits, TLabels, TListBoxes) for 1) The final square root, 2) The number of iterations, 3) Delphis built-in square root, and 4) The converging roots during the calculation. Be creative in your visual design. Use the exception mechanism to catch errors, and display appropriate messages using the simple ShowMessage procedure. Thought provoking questions:How does changing the desired accuracy from, say, 0.001 to 0.0000001, affect the number of iterations?Can you think of a better first guess than halfway between 1.0 and the number? Hint: Look at some normalized values, that is, values between 0.0

Use the order calculator below and get started! Contact our live support team for any assistance or inquiry.

[order_calculator]
CategoriesUncategorized