class circle { int x, y; // center coordinates double radius; circle(int a, int b, int r) {x=a;y=b;radius=r;} double area() {return Math.PI*radius*radius;} double circumference() {return Math.PI*radius*2;} double distance(circle other) { int dx = x-other.x, dy = y-other.y; return Math.sqrt(dx*dx + dy*dy); } } class rectangle { int x, y; // coordinates of upper-left corner double width, height; rectangle(int a, int b, double w, double h) { x=a; y=b; width=w; height=h; } double area() { return width*height; } double circumference() { return width*2 + height*2; } double distance(rectangle other) { int dx = x-other.x, dy = y-other.y; return Math.sqrt(dx*dx + dy*dy); } } // ... triangle, etc public class shapes1 { public static void main(String[] args) { circle C[] = new circle[2]; rectangle R[] = new rectangle[2]; C[0] = new circle(3,4,5); C[1] = new circle(50,60,10); R[0] = new rectangle(3,4,5,6); R[1] = new rectangle(30,40,50,60); double totalarea = 0; for(var c:C) totalarea+=c.area(); for(var r:R) totalarea+=r.area(); System.out.printf("totalarea = %.2f\n",totalarea); }//main }