//Love.java
public class Love extends Thread implements Runnable {human boy,girl; public void Love(human boy,human girl) {this.boy=boy; this.girl=girl; } public void run() { if(boy.有房() && boy.有车()) {boy.setWife(girl); boy.setNothing(true); return; } while(girl.愿意等()) { for(day=1; day<=365; day++) {if(day.is情人节()) if(boy.hadGiveGirl玫瑰()) girl.感情++; else girl.感情--; if(day.isGirls生日()) if(boy.hadGiveGirl玫瑰()) girl.感情++; else girl.感情--; boy.拼命赚钱(); } girl.年龄++; boy.年龄++; girl.感情--; if(boy.有房() && boy.有车()) {boy.setWife(gril); boy.setNothing(true); return; } else if(boy.赚钱>100000 && girl.感情> continue; else girl.setOwner(lookForAnotherBoy()); return; } girl.setOwner(lookForAnotherBoy()); } public lookForAnotherBoy() { human another_boy; int size=girl.追求者().getSize(); if(size==0) throw new 没有追求者Exception(); while(int i=0;i {another_boy=girl.追求者().getItem(); if(another_boy.有房()&&another_boy.有车()) return another_Boy; } throw new 我要独身Exception(); } } public class 同性恋 extends Love {human boy,girl; public void Love(human boy,human girl) {this.boy=boy; this.girl=girl; } public void run() { if( 性别相同 ) { super.run(); }else { return; } |
|