package 기말고사;
class Circle{
int x,y,r;
double area=r*r*3.14;
public double getArea() {
return area;
}
public String toString() {
return "("+x+","+y+")"+" r=";
}
}
public class CircleTest {
static void getLarest(Circle circle) { //가장 큰 원을 구하는 메소드 선언
int max=0;
for (int i = 0; i < 5; i++) {
circle.r= (int)(Math.random()*10)+1; //1~10의 반지름 중 5개를 랜덤으로 선언하기
if(max<circle.r) {
max = circle.r; // 선언한 반지름 중 가장 큰 원넓이 구하기
}
}
circle.area = max*max*3.14;
System.out.println(circle.area);
}
public static void main(String[] args) {
Circle circle = new Circle();
for(int i=0; i<5;i++) {
circle.x= (int)(Math.random()*10)+1; //원 좌표를 랜덤으로 구하기
circle.y= (int)(Math.random()*10)+1;
}
System.out.print(circle);
getLarest(circle); // 가장 큰 원 출력
}
}