该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
import java.util.Scanner;
/*
* 题目:输入:第一行是一个整数标识长方形的个数n(n<100),第二行开始分别是其长a和宽b。a,b都是整数,a,b<1000;
* 输出:他们的面积s和特性f。特性f为三个词之一。tall,short,square;如果长大于宽则显示tall,如果长小于宽则显示short,如果相等则显示square。
*/
public class Rectangle {
int a;// 长
int b;// 宽
public Rectangle() {
}
public Rectangle(int a, int b) {
this.a = a;
this.b = b;
}
public int caculateArea() {
int s = this.a * this.b;
return s;
}
public String getFeture() {
String f = "";
if (this.a > this.b) {
f = "tall";
} else if (this.a < this.b) {
f = "short";
} else {
f = "square";
}
return f;
}
public static void main(String[] args) {
Scanner n = new Scanner(System.in);
int x = n.nextInt();
int y = n.nextInt();
int z = n.nextInt();
int i = 0;
for (i = 0; i < x; i++) {
Rectangle ri = new Rectangle(y, z);
System.out.println(ri);
System.out.println(ri.caculateArea());
System.out.println(ri.getFeture());
}
}
}