Shape.java
package com.imooc;
public abstract class Shape {
public abstract void Perimeter();//周长
public abstract void Area();//面积
}
Rectangle.java
package com.imooc;
import java.util.Scanner;
public class Rectangle extends Shape {
//让用户自己输入矩形的长和宽
{
System.out.println("请输入矩形长:");
}
Scanner input = new Scanner(System.in);
private float long1 = input.nextFloat();
{
System.out.println("请输入矩形宽:");
}
private float wide = input.nexFloat();
//求矩形的周长和面积方法
@Override
public void Perimeter() {
// TODO 自动生成的方法存根
float perimeter= (long1+wide)*2;
System.out.println("Rectangle的周长为:" + perimeter );
}
@Override