顯示廣告
隱藏 ✕
看板 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
※ 同主題文章:
※ 看板: Programming 文章推薦值: 0 目前人氣: 0 累積人氣: 988 
1樓 時間: 2014-07-08 20:38:58 (台灣)
  07-08 20:38 TW
Please express your thinking first
r)回覆 e)編輯 d)刪除 M)收藏 ^x)轉錄 同主題: =)首篇 [)上篇 ])下篇
看板名稱: 確定(Enter) 取消(Esc) 搜尋(Space)
查詢帳號: 確定(Enter) 取消(Esc) 搜尋(Space)
搜尋: m)m文 b)進板 c)未分類 a)作者 /)標題 q)取消?[q]

搜尋 送出(Enter) 取消(Esc)

回覆文章至: f)看板 m)作者信箱 b)兩者皆是 q)取消?[f]
要引用原文嗎? y)引用原文 n)不引用 a)全部回覆 r)複製原文 q)取消?[y]
轉錄本文章於看板: 1)使用連結 2)使用複製 q)取消 ?[1]
轉寄至站內信箱於使用者: 確定(Enter) 取消(Esc)
轉寄至站內信箱於使用者: 確定(Enter) 取消(Esc)
修改文章標題為: 確定(Enter) 取消(Esc)
修改文章標題為: 確定(Enter) 取消(Esc) 全部(a)

確定要刪除這篇文章?(可按大U救回) 確定(Enter) 取消(Esc)

刪除理由:

確定(Enter) 取消(Esc)
加到這個分類: 確定(Enter) 下一層(→) 回上層(←) 取消(Esc)
你覺得這篇文章: 1)真讚 2)真瞎 q)取消?[1] (再選一次即可收回)
你覺得這篇文章: 1)值得推薦 2)表示反對 3)單純註解 q)取消?[3]
guest
預覽(Enter) 取消(Esc)
上傳圖片
按ctrl+Enter可輸入下一行。
guest
確定要送出? 確定(Enter) 取消(Esc) 繼續(e)
搜尋: 送出(Enter) 取消(Esc)

▏▎▍▌▋▊▉ 請按任意鍵繼續