以下の問題のプログラムを書きたいのですが、どうも頭がこんがらがってわかりません。
lang
1public class LineSegment{ 2 private double x, y; 3 private double x1, y1; 4 5 public LineSegment(double x, double y){ 6 this.x = x; 7 this.y = y; 8 } 9 public void linearTransfer(){ 10 this.x1 = 6 * this.x + 4 * this.y; 11 this.y1 = -2 * this.x + this.y; 12 } 13 public final double getX1(){ 14 return x1; 15 } 16 public final double getY1(){ 17 return y1; 18 } 19} 20 class ThickLineSegment extends LineSegment{ 21 ThickLineSegment(double x1, double y1,double x2,double y2){ 22 super(x1,y1); 23 super(x2,y2); 24 } 25 ThickLineSegment(double x, double y,int w){ 26 super(x,y); 27 this.setWidth(w); 28 } 29 ThickLineSegment(double x1, double y1,double x2,double y2,int w){ 30 super(x1,y1); 31 super(x2,y2); 32 this.setWidth(w); 33 } 34 void setWidth(int w){ 35 int awidth=w; 36 } 37 38} 39 40
ここまで書いたんですが、どう改良したらうまく動くのか。。。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/07/03 14:37