192403蒲文强——面向对象第五次作业

import java.util.*;

/**

  • @author Shinelon
  • @project my homeworkpapapa
  • @package PACKAGE_NAME
  • @date 2019/9/18 9:18
    /
    class Square {
    int length;
    int area;
    int wide;
    int primeter;
    int getarea(){
    area=length
    wide;
    System.out.println("面积"+area);
    return area;
    }
    int getprimeter(){
    primeter=length2+wide2;
    System.out.println("周长"+primeter);
    return primeter;
    }
    }

public class Zy {
public static void main(String[] args) {
Square squpapapa = new Square();
System.out.println("输入长度");//笨蛋 请输入大于0的数
Scanner in = new Scanner(System.in);
squpapapa.length = in.nextInt();
System.out.println("输入宽");//一样!
Scanner in1=new Scanner(System.in);
squpapapa.wide=in1.nextInt();
squpapapa.getarea();

squpapapa.getprimeter();

}
}

posted on 2019-09-18 18:03  Amiri-BOY  阅读(185)  评论(0编辑  收藏  举报

导航