正在加载图片...
Java object representation (single class) Class point i //A Point object represents a geometric point located at(x,y) protected int (1) public Point (int x, int y)& this this (2) public void move(int dx, int dy)i This x+=dx; this y += dy (3)public float area(( turn 0.0 (4)public float dist(point that) t dx thisx- that x dy this y -tha urn Mat sqrt(dx *dy dy * dyJava object representation (single class) Class Point { // A Point object represents a geometric point located at (x,y). protected int x, y; (1) public Point (int x, int y) { this .x = x; this .y=y; } (2) public void move (int dx, int dy) {. This .x += dx; this .y += dy; } (3) public float area ( ) { return 0.0; } (4) public float dist (Point that ) {. int dx = this.x – that .x; int dy = this.y – that.y; return Mat.sqrt (dx*dy + dy*dy); } }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有