import javax.swing.JOptionPane;
abstract class Area{
abstract double area();
}
class RoundArea extends Area{
double r;
RoundArea(){
r=0.0d;
}
RoundArea(double r){
this.r=r;
}
double area(){
JOptionPane.showMessageDialog(null,"输出圆面积"+(3.14*r*r));
return 3.14*r*r;
}
}
class RectArea extends Area{
double x;
double y;
RectArea(){
x=0.0d;
y=0.0d;
}
RectArea(double x,double y){
this.x=x;
this.y=y;
}
double area(){
JOptionPane.showMessageDialog(null,"输出矩形面积"+(x*y));
return x*y;
}
}
class ImpleArea extends RectArea{
void disa(){
String s1=JOptionPane.showInputDialog("输入半径");
double R=Double.parseDouble(s1);
new RoundArea(R);
}
void disb(){
String s2=JOptionPane.showInputDialog("输入长");
double C=Double.parseDouble(s2);
String s3=JOptionPane.showInputDialog("输入宽");
double K=Double.parseDouble(s3);
new RectArea(C,K);
}
}
class BB {
public static void main (String[] args) {
ImpleArea z=new ImpleArea();
z.disa();
z.disb();
}
}