gistfile1.txt package mainscond;import java.util.*;class Rectangle{//长方形private int width;private int length;public Rectangle(int width,int length) {this.width=width;this.length=length;}public int getWidth() {return width;}public void
package mainscond;
import java.util.*;
class Rectangle{
//长方形
private int width;
private int length;
public Rectangle(int width,int length) {
this.width=width;
this.length=length;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
}
public int getPerimeter() {
return 2*(width+length);
}
public int getArea() {
return width*length;
}
public String toString() {
return String.format("Rectangle [width=%d, length=%d]",width,length);
}
}
class Triangle{
//三角形
private int width;
private int high;
public Triangle(int width,int high) {
this.width=width;
this.high=high;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHigh() {
return high;
}
public void setHigh(int high) {
this.high= high;
}
public int getPerimeter() {
return 3*width;
}
public int getArea() {
double i;
i= (width*high)/2;
return (int)i;
}
public String toString() {
return String.format("Triangle [width=%d, high=%d]",width,high);
}
}
class Circle{
private int radius;
public Circle(int radius) {
this.radius=radius;
}
public int getPerimeter() {
double i;
i = 2*(double)radius*Math.PI;
return (int)i;
}
public int getArea() {
double i;
i = ((double)radius)*((double)radius)*Math.PI;
return (int)i;
}
public String toString() {
return String.format("Circle [radius=%d]",radius);
}
}
public class Main3 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Rectangle [] a = new Rectangle[2];
Circle [] b = new Circle[2];
Triangle [] c = new Triangle[2];
a[0] = new Rectangle(sc.nextInt(),sc.nextInt());
a[1] = new Rectangle(sc.nextInt(),sc.nextInt());
b[0] = new Circle(sc.nextInt());
b[1] = new Circle(sc.nextInt());
c[0] = new Triangle (sc.nextInt(),sc.nextInt());
c[1] = new Triangle (sc.nextInt(),sc.nextInt());
System.out.println(a[0].getPerimeter()+a[1].getPerimeter()+b[0].getPerimeter()+b[1].getPerimeter()+c[0].getPerimeter()+c[1].getPerimeter());
System.out.println(a[0].getArea()+a[1].getArea()+b[0].getArea()+b[1].getArea()+c[0].getArea()+c[1].getArea());
String astr = Arrays.deepToString(a);
String bstr = Arrays.deepToString(b);
String cstr = Arrays.deepToString(c);
System.out.println(astr);
System.out.println(bstr);
System.out.println(cstr);
}
}
