import Test.Tuzi;
public class Tuzi1 {
public String sex;
public int height;
public double weight;
public void show(){
if("男".equals(sex)){
if(weight<(height-103)){
System.out.println("你的标准身高:"+(height-103)+"~"+(height-97)+"你该增肥了奥");
}else if(weight>(height-97)){
System.out.println("你的标准身高:"+(height-103)+"~"+(height-97)+"亲爱的小猪猪,好像是该减肥了啊");
}else{ System.out.println("嗯,不错,你很标准呢");
}
} else if("女".equals(sex)){
if(weight<(height-113)){
System.out.println("你的标准身高:"+(height-113)+"~"+(height-107)+"你该增肥了奥");
}else if(weight>(height-107)){
System.out.println("你的标准身高:"+(height-113)+"~"+(height-107)+"亲爱的小猪猪,好像是该减肥了啊");
}else{ System.out.println("嗯,不错,你很标准呢");
}
}else{
System.out.println("傻子,连自己性别都不知道吗?赶紧回家问问你妈");
}
}
public class Tuzi2 { public static void main(String[] args) { Tuzi1 q=new Tuzi1(); q.sex="女"; q.height=160; q.weight=320; q.show(); }}
}
转载于:https://www.cnblogs.com/hljj/p/6858631.html
相关资源:Java 面向对象编程.pdf