Create a LatticePoint class such that each point consists of a pair of integers ( x, y ).
Include constructors, getter and setter methods, and an addition method,
LatticePoint add(LatticePoint p);
de ned by the rule ( a, b ) 1 ( c, d ) 5 ( a 1 c, b 1 d ).
Implement a method that returns the distance between two points:
double distance(LatticePoint p);
such that the distance between ( a, b ) and ( c, d ) is de ned as √
Overload the distance method, so that the call
p.double distance()
returns the distance from (0, 0) to p.
Create a LatticePoint class such that each point consists of a pair of integers ( x, y ).Include constructors, getter and setter methods, and an addition method, LatticePoint add(LatticePoint p); de ned by the rule ( a, b ) 1 ( c, d ) 5 ( a 1 c, b 1 d ). Implement a method that returns the distance between two points: double distance(LatticePoint p); such that the distance between ( a, b ) and ( c, d ) is de ned as √ Overload the distance method, so that the call p.double distance() returns the distance from (0, 0) to p.
การแปล กรุณารอสักครู่..

สร้างคลาส LatticePoint ดังกล่าวว่าแต่ละจุดประกอบด้วยคู่ของจำนวนเต็ม (x, y). รวมถึงการก่อสร้างทะเยอทะยานและวิธีการตั้งค่าและวิธีการนอกจากนี้, LatticePoint เพิ่ม (LatticePoint พี); เด ned โดยกฎ (A, B) 1. (c, d) 5 (1 C, ข 1 ง) ใช้วิธีการที่ผลตอบแทนระยะห่างระหว่างสองจุดนี้: ระยะทางคู่ (LatticePoint พี) ดังกล่าวว่าระยะห่างระหว่าง (A, B) และ (C, D ) คือ ned เป็น√เกินระยะทางที่วิธีการเพื่อให้การโทรทางไกลp.double () ผลตอบแทนระยะทางจาก (0, 0) ไปยังพี
การแปล กรุณารอสักครู่..

สร้าง latticepoint ชั้นซึ่งแต่ละจุดจะประกอบด้วยคู่ของจำนวนเต็ม ( x , y )
รวม constructors , เก็ตเตอร์และวิธีการตั้งค่า และนอกจากนี้วิธี
latticepoint เพิ่ม ( latticepoint p ) ;
de เน็ด ตามกฎ ( a , b ) 1 ( C , D ) 5 ( 1 C , B 1 D )
ใช้วิธีการที่ส่งกลับค่าระยะทางระหว่างจุดสองจุด :
คู่ระยะทาง ( latticepoint P )
;เช่น ระยะห่างระหว่าง ( a , b ) และ ( c , d ) คือ เด เน็ดเป็น√
เกินระยะทางที่วิธีการเพื่อให้เรียก
p.double distance()
กลับจากระยะทาง ( 0 , 0 ) หน้า
การแปล กรุณารอสักครู่..
