一则很搞笑的代码

cicada_IT 写道
代码如下:

java 代码
import org.springframework.beans.BeanUtils;

public class People {
public class Contants {
public static final int 情人节 = 120;

public static final int THING_ROSE = 1;
public static final int THING_KISS = 2;
public static final int THING_HUG = 3;
public static final int THING_ANGRY = 4;
public static final int THING_OTHER = 5;

public static final double MONEY = 100000.00;
public static final int LOVE = 100;
public static final int AGE = 30;

}
public static class Boy {
private boolean 有车;
private boolean 有房;
private double 赚钱;
private int 年龄 = 15;

public Boy() {
super();
}
public Boy(boolean isOwnCar,boolean isOwnHouse) {
有车 = isOwnCar;
有房 = isOwnHouse;
}
public Boy(boolean isOwnCar,boolean isOwnHouse,double partMoeny) {
有车 = isOwnCar;
有房 = isOwnHouse;
赚钱 = partMoeny;
}

public void setBoy(Boy boy) {
BeanUtils.copyProperties(this, boy);
}
public boolean givegirl(int thing) {
switch(thing) {
case Contants.THING_ROSE:
case Contants.THING_KISS:
case Contants.THING_HUG:
return true;
case Contants.THING_ANGRY:
case Contants.THING_OTHER:
return false;
}
return false;
}
public void 拼命赚钱() {
赚钱 ++;
}
public int get年龄() {
return 年龄;
}
public void set年龄(int 年龄) {
this.年龄 = 年龄;
}
public boolean is有车() {
return 有车;
}
public void set有车(boolean 有车) {
this.有车 = 有车;
}
public double get赚钱() {
return 赚钱;
}
public void set赚钱(double 赚钱) {
this.赚钱 = 赚钱;
}
public boolean is有房() {
return 有房;
}
public void set有房(boolean 有房) {
this.有房 = 有房;
}

}
public static class Girl {
private boolean 等;
private int 感情;
private int 生日;


public Boy 嫁给(Boy boy) {
return boy;
}
public boolean is等() {
return 等;
}
public void set等(boolean 等) {
this.等 = 等;
}
public int get感情() {
return 感情;
}
public void set感情(int 感情) {
this.感情 = 感情;
}
public int get生日() {
return 生日;
}
public void set生日(int 生日) {
this.生日 = 生日;
}
}

public boolean loveLoad(Boy boy,Girl girl) {
if (boy.is有房() && boy.is有车()) {
boy.setBoy(null);
girl.嫁给(boy);
} else {
if(girl.is等()) {
System.out.println("====1");
while (! (boy.get赚钱() > Contants.MONEY && girl.感情 > Contants.LOVE && boy.get年龄() < Contants.AGE)) {
System.out.println("====2");
for(int day = 1; day < 365 ; day ++) {
System.out.println("====3");
if(day == Contants.情人节) {
if(boy.givegirl(Contants.THING_ROSE)) {
girl.set感情(girl.get感情() + 1);
} else {
girl.set感情(girl.get感情() - 1);
}
}
if(day == girl.get生日()) {
if(boy.givegirl(Contants.THING_ROSE)) {
girl.set感情(girl.get感情() + 1);
} else {
girl.set感情(girl.get感情() - 1);
}
}
boy.拼命赚钱();
}
if(boy.is有房() && boy.is有车()) {
boy.setBoy(null);
girl.嫁给(boy);
return true;
}
boy.set年龄(boy.get年龄() + 1);
girl.set感情(girl.get感情() - 1);
}
if(boy.get年龄() > Contants.AGE) {
girl.嫁给(new Boy());
return false;
}
} else {
girl.嫁给(new Boy());
return false;
}
}
return false;
}
public static void main(String []args) {
People people = new People();
Boy litterBoy = new Boy();
litterBoy.set年龄(15);
litterBoy.set有房(false);
litterBoy.set有车(false);
litterBoy.set赚钱(0.00);
Girl goodGirl = new Girl();
goodGirl.set生日(100);
goodGirl.set感情(0);
goodGirl.set等(true);
System.out.println(people.loveLoad(litterBoy, goodGirl));
}
}
申明:这个是转来的,出自何方不清楚,反正来自互联网,作者是男是女,不祥。听说是女的。嘿嘿。。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值