-->
当前位置:首页 > 题库 > 正文内容

编程题:横平竖直

Luz4年前 (2021-05-10)题库701
程序填空题。根据题目要求完善下面的代码。请提交完整代码。
一个木块如果高度比宽度大,我们说它是竖着放的,否则我们说它是平放的。
读入一个木块的高度和宽度。如果它是平放的,则输出A,否则输出B。

import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int height, width;
char status;
height = in.nextInt();
width = in.nextInt();
Board board = new Board(height, width);
status = board.getStatus();
System.out.print(status);
}
}
class Board{
int height, width;
public Board(int height, int width){
this.height = height;
this.width = width;
}
public char getStatus(){
if(height<=width){
return status(1);
}else{
return status(1.0);
}
}
public char status(double rate){

}
public char status(int rate){

}
}


### 输入格式:

输入在一行中给出2个绝对值不超过1000的正整数A和B。

### 输出格式:

在一行中输出一个字符A或者B。

### 输入样例:
```in
50 50
```

### 输出样例:
```out
A
```





答案:若无答案欢迎评论

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。