Day3課題2
q5の1~3まで終了
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
|
||||
public class Shape {
|
||||
public abstract class Shape {
|
||||
|
||||
private String name; //フィールドname ・privateにしなきゃいけない
|
||||
public double area;
|
||||
public int radius;
|
||||
// public double area;
|
||||
// public int radius;
|
||||
|
||||
|
||||
public Shape() {
|
||||
}
|
||||
@@ -12,8 +13,8 @@ public class Shape {
|
||||
this.name = name; //Circleが"円"を呼び出すための文字列をいれるところ
|
||||
}
|
||||
|
||||
public double area() { //メソッドarea 引数なし・戻り値double 中身return0.0;
|
||||
return 0.0;
|
||||
public abstract double area();{ //メソッドarea 引数なし・戻り値double 中身return0.0;
|
||||
// return 0.0;
|
||||
}
|
||||
|
||||
// @Override
|
||||
@@ -21,7 +22,8 @@ public class Shape {
|
||||
|
||||
public void showInfo(){ //メソッドshowinfo 引数戻り値なし・中身はsyso
|
||||
System.out.println(this.name + "の面積は" + this.area() + "です");
|
||||
System.out.println("(半径:" + this.radius + ")");
|
||||
// System.out.println("(半径:" + this.radius + ")");
|
||||
System.out.println("四角形" + "の面積は" + this.area() + "です。");
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
||||
Reference in New Issue
Block a user