输入长方形的长和宽,求面积和周长

       Systwn.out.println("请输入长和宽");
        int i = chang();
        int j = kuan();
        int sum = add(i,j);
        int sum1 = add1(i,j);
        System.out.println();
}
public static int add(int i,int j){
        System.out.println("面积:"+i*j);
        return i*j;
}
public static int add(int i,int j){
        System.out.println("周长:"+(i+j)*2); 
        return (i+j)*2
}
public static int chang(){
      Scanner sc = new Scanner(System.in);
      int i = sc.nextInt();
      return i;
}
public static int kuan(){
      Scanner sc = new Scanner(System.in);      
       int j = sc.nextInt();    
       return j;
 }
 

你可能感兴趣的:(笔记)