形状类接口
public interface Shape {
public void perimeter();//周长
public void area();//面积
}
Rect(矩形)
public class Rect implements Shape{
Scanner scanner=new Scanner(System.in);
int length =scanner.nextInt();//长
int width=scanner.nextInt();//宽
int high=scanner.nextInt();//高
@Override
public void perimeter() {
}
@Override
public void area() {
}
}
Circle(圆形)
public class Circle implements Shape{
double π=3.14;
Scanner sc=new Scanner(System.in);
int perimeter=sc.nextInt();
@Override
public void perimeter() {
}
@Override
public void area() {
}
}
Square(正方形)
public class Square extends Rect{
Scanner sc=new Scanner(System.in);
public void Rect(){
}
}
测试类
public class Test {
public static void main(String[] args) {
System.out.println("---------求矩形,圆,正方形的周长和面积-------");
}
}