package org.com;
import java.util.Scanner;
public class Demo1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("计算圆的面积和周长:\n1.计算面积\n2.计算周长\n请选择:");
int a = input.nextInt();
System.out.println("请输入半径:");
int b = input.nextInt();
int c = mianji(b);
int d = zhouchang(b);
if (a==1) {
mianji(a);
}
else if(a==2){
zhouchang(a);
}
else {
System.out.println("选择错误!");
}
}
public static int mianji(int x) {
double mj = 3.14*x*x;
System.out.println("圆的面积为:"+mj);
return x;
}
public static int zhouchang(int x) {
double zch = 2*3.14*x;
System.out.println("圆的周长为:"+zch);
return x;
}
}