看板 Programming
作者 Leon (Leon)
標題 問一題JAVA的習題
時間 2014年07月03日 Thu. PM 09:47:50


小弟在自學JAVA中
教材是Think Java
目前在第六章習題6.5卡關
麻煩大家指點迷津^^

Exercise 6.5.
The distance between two points (x1, y1) and (x2, y2) is Distance = 根號((x2 x1)^2 + (y2 y1)^2)
Write a method named distance that takes four doubles as parameters—x1, y1, x2 and y2—and that prints the distance between the points.
You should assume that there is a method named sumSquares that calculates and returns the sum of the squares of its arguments. For example:
double x = sumSquares(3.0, 4.0);
would assign the value 25.0 to x.
The point of this exercise is to write a new method that uses an existing one.
You should write only one method: distance.
You should not write sumSquares or main and you should not invoke distance.

搞不懂它到底要我怎麼做@@

--
※ 作者: Leon 時間: 2014-07-03 21:47:50
※ 同主題文章:
問一題JAVA的習題
07-03 21:47 Leon
01-28 16:41 sunhang09
Leon: 問一題JAVA的習題 - Programming板