展开全部
public class Circle(){
double pi = 3.14;
public double area(double r){
return pi*r*r;
}
public double perimeter(double r){
return 2*pi*r;
}
}
public class Coin extends Circle {
public double setValue(double r){
double value = super.area(r);
return value;
}
}
public class Test{
public static void main(String[] args) {
System.out.println("输入圆的半径:");
Scanner input=new Scanner(System.in);
double r=input.nextDouble();
Coin c = new Coin();
double value = c.setValue(r);
System.out.println("面积为:"+value);
}
}
double pi = 3.14;
public double area(double r){
return pi*r*r;
}
public double perimeter(double r){
return 2*pi*r;
}
}
public class Coin extends Circle {
public double setValue(double r){
double value = super.area(r);
return value;
}
}
public class Test{
public static void main(String[] args) {
System.out.println("输入圆的半径:");
Scanner input=new Scanner(System.in);
double r=input.nextDouble();
Coin c = new Coin();
double value = c.setValue(r);
System.out.println("面积为:"+value);
}
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询