文件名称:SquareRoot
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:1kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
import java.io.* public class SquareRoot { public static void main ( String [ ] args )
{ System.out.print("Enter a positive value: ") double value = 0 try { BufferedReader in
= new BufferedReader(new InputStreamReader(System.in)) String inputLine = in.readLine()
value = Double.valueOf(inputLine).doubleValue() } catch (Exception exc)
{ System.out.println("Input error!") return } if (value < 0) System.out.println("Input
error!") else { double root = 1 double pre = 0 do { pre = root root = (value / root +
root) / 2 } while ((pre - root > 0.000001) || (root - pre > 0.000001)) System.out.println("The
root of " + value + " is " + root) } } }
你容易理解这个程序吗?在计算机上运行该程序,看看该程序完成什么功能?尝试利用
分行、缩进、空行、空格等为该程序重新排版,并加上合适的注释。(提示:所谓程序的排
版不同于WPS 2000 那种对文档的排版,后者主要是对字体、字形、字号、字间距、行间距等格式的处理。
-Import Java. IO.* Public class SquareRoot {public static void main (String [] args)
{System. Print out. (" Enter a positive value: ") Double value = 0 Try {BufferedReader in
= new BufferedReader (new InputStreamReader (System..)) String inputLine = in. ReadLine ()
Value = Double. ValueOf (inputLine). DoubleValue () } catch (Exception exc)
{System. Out. Println (" Input error! ") Return } if value (< 0) System. Println. (" Input out
Error!!!!!") else {double root = 1 double pre = 0 do {pre = root root = (value/root+
Root)/2 } while ((pre-root > 0.000001) | | (root-pre > 0.000001)) System. Out. Println (The "
Root of "value++" is "+ root) }}}
You easy to understand this program? On the computer to run the program, check to see if the program finish what function? Try to take advantage of
Branch, indentation, empty line for the program, such as space to typesetting, and add the right note. (hint: the so-called program row
Version is different from that of d
{ System.out.print("Enter a positive value: ") double value = 0 try { BufferedReader in
= new BufferedReader(new InputStreamReader(System.in)) String inputLine = in.readLine()
value = Double.valueOf(inputLine).doubleValue() } catch (Exception exc)
{ System.out.println("Input error!") return } if (value < 0) System.out.println("Input
error!") else { double root = 1 double pre = 0 do { pre = root root = (value / root +
root) / 2 } while ((pre - root > 0.000001) || (root - pre > 0.000001)) System.out.println("The
root of " + value + " is " + root) } } }
你容易理解这个程序吗?在计算机上运行该程序,看看该程序完成什么功能?尝试利用
分行、缩进、空行、空格等为该程序重新排版,并加上合适的注释。(提示:所谓程序的排
版不同于WPS 2000 那种对文档的排版,后者主要是对字体、字形、字号、字间距、行间距等格式的处理。
-Import Java. IO.* Public class SquareRoot {public static void main (String [] args)
{System. Print out. (" Enter a positive value: ") Double value = 0 Try {BufferedReader in
= new BufferedReader (new InputStreamReader (System..)) String inputLine = in. ReadLine ()
Value = Double. ValueOf (inputLine). DoubleValue () } catch (Exception exc)
{System. Out. Println (" Input error! ") Return } if value (< 0) System. Println. (" Input out
Error!!!!!") else {double root = 1 double pre = 0 do {pre = root root = (value/root+
Root)/2 } while ((pre-root > 0.000001) | | (root-pre > 0.000001)) System. Out. Println (The "
Root of "value++" is "+ root) }}}
You easy to understand this program? On the computer to run the program, check to see if the program finish what function? Try to take advantage of
Branch, indentation, empty line for the program, such as space to typesetting, and add the right note. (hint: the so-called program row
Version is different from that of d
(系统自动生成,下载前可以参看下载内容)
下载文件列表
SquareRoot.java
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.