現在図形の形を変更させるプログラムを書いています。下のようなソースを書きましたが、「シンボルを見つけられません」というエラーが出てしまい困っています。
class Rectangle { String color; double x, y; double width, height; Rectangle(String color, double x, double y, double width, double height) { this.color = color; this.x = x; this.y = y; this.width = width; this.height = height; } //図形の平行移動 void move(double x,double y) { x=x+20.0; y=y+10.0; return; } //図形を90度回転 void rotate90() { double tmp=0.0; tmp=width; width=height; height=tmp; return; } public String toString() { return(color +"rectangle at ("+ x +","+ y +") with W:"+ width +"and H:"+ height); } } class Main { public static void main(String[] args) { Rectangle rec1 = new Rectangle("yellow", 3.0, 4.0, 5.0, 6.0); System.out.println(rec1); System.out.print("x軸方向に"+rec1.move(x)+"y軸方向に"+rec1.move(y)+"平行移動します"); System.out.println(rec1.rotate90()+"90度回転します"); } }
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。