首页 > 代码库 > 2015愿景

2015愿景

import java.io.PushbackReader;
import java.util.Random;

/**
 * 
 * @author puhaitao
 *
 *年复一年,但2015只有一次,但愿能够珍惜
 */

public class My2015 {
	

	private static My2015 my2015;	
	
	private My2015() {
		// TODO Auto-generated constructor stub
		
		sayByeByeTo2014("岁月匆匆,再见,2014,再也回不去了。╥﹏╥");
		sayHelloTo2015("2015,我来了,颤抖吧!( ̄︶ ̄)↗");
	}
	
	public static My2015 GoTo2015(){
		if(my2015==null){  
            synchronized(My2015.class){  
                if(my2015==null){  
                	my2015=new  My2015();  
                }  
            }              
        }
		return my2015;  
	}
	
	private void sayByeByeTo2014(String byebye){
		System.out.println(byebye);
	}
	private void sayHelloTo2015(String hello) {
		System.out.println(hello);
	}
	
	public void workhardForMyDream(Dream dream,double score){
		dream.printInfo(score);
		boolean status=dream.makeEfforts(score);
	   if(status){
		   System.out.println(Dream.COMETRUE);
	   }else{
		   System.out.println(Dream.BEYONDHOPE);
	   }
	}
	
	public static void main(String[] args) {
		My2015 my_2015=My2015.GoTo2015();
		Dream earnMoreMony=new Dream() {

			@Override
			public void printInfo(double score) {
				// TODO Auto-generated method stub
				System.out.println("我希望能在2015年挣钱,很多很多的钱。我的努力值是:"+score+"↖(^ω^)↗");
			}};
		Dream fallingLove=new Dream() {

			@Override
			public void printInfo(double score) {
				// TODO Auto-generated method stub
				System.out.println("大家都说我老大不小了,该找个媳妇儿了。我的主动值是:"+score+"(*^﹏^*)");
			}};		
		Dream behealth=new Dream() {

			@Override
			public void printInfo(double score) {
				// TODO Auto-generated method stub
				System.out.println("我希望自己以及家人能在新的一年平平安安的。我的运动值是:"+score+"╭(′▽`)╭(′▽`)╯");
			}};		
		Dream behappy=new Dream() {

			@Override
			public void printInfo(double score) {
				// TODO Auto-generated method stub
				System.out.println("只要有钱、有姑娘、身体健康,我就开心啦、我的开心值是:"+score);
			}};
		double workhard=Math.random()*100;
		double aggressive=Math.random()*100;
		double sports=Math.random()*100;
		double GNH=workhard>=80&&aggressive>=80&&sports>=80?(workhard+aggressive+sports)/3:Math.random()*80;
		my_2015.workhardForMyDream(earnMoreMony,workhard);
		my_2015.workhardForMyDream(fallingLove,aggressive);
		my_2015.workhardForMyDream(behealth,sports);
		my_2015.workhardForMyDream(behappy,GNH);
	}	
}

abstract class Dream{
	
	public final static String  COMETRUE="梦想能够实现!:-D ";
	public final static String  BEYONDHOPE="继续努力吧,别做梦了!(>﹏<)";
	public abstract void printInfo(double score);
	public boolean  makeEfforts(double score){
		if(score>80){
			return true;
		}else{
			return false;
		}
	}
}


2015愿景