1 Star 0 Fork 0

沈梦然 / 16012021沈梦然_考核二

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
hw.java 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
沈梦然 提交于 2018-10-13 00:29 . 7-3 横平竖直
import java.util.Scanner;
public class hw{
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(){
int A=1,B=0;
if(height<=width){
return status(1);
}else{ //定义不同类型的返回值
return status(1.0);
}
}
public char status(double rate){
System.out.println("B"); //double为竖着放
return 0; //返回主类输出B
}
public char status(int rate){
System.out.println("A"); //int为平着放
return 0; //返回主类输出A
}
}
Java
1
https://gitee.com/smr_777/16012021__shen_mengran.git
git@gitee.com:smr_777/16012021__shen_mengran.git
smr_777
16012021__shen_mengran
16012021沈梦然_考核二
master

搜索帮助