my own phrase-o-matic program

I took Head First Java to get fluent in Java for this summer. There is this program called phrase-o-matic which will automatically generate phrases.
This is the code for the program (in the book)…..

public class ex1 {
	public static void main(String[] args) {
		String[] listone = {"24/7","Multi-Tier","30,000 foot","B-to-B","win-win","front-end","web-based","pervasive","smart","six-sigma","critical-path","dynamic"};
		String[] listtwo = {"empowered","value-added","oriented","centric","distributed","clustered","branded","outside-the-box","positioned","networked","focused","leveragred","aligned","targeted","shared","cooperative","acclerated"};
		String[] listthr = {"process","tipping-point","solution","architecture","core competency","stratergy","mindshare","portal","space","vision","paradigm","mission"};
		int onel=listone.length;
		int twol=listtwo.length;
		int thrl=listthr.length;
		int i;
		int ran1=(int)(Math.random()*onel);
		int ran2=(int)(Math.random()*twol);
		int ran3=(int)(Math.random()*thrl);
		String phrase=listone[ran1]+" "+listtwo[ran2]+" "+listthr[ran3];
		System.out.println("What we need here is a "+phrase);
	}
}

and this is my own little phrase-o-matic code

public class my_phraseOMatic {
	public static void main(String[] args) {
		String[] you_are_what={"a programmer","a coder","a web designer","a web developer","a FOSS enthusiast","an app developer","a codejammer","a blogger","a boring person","a computer science student","an engineer","an eco graduate","a proffesor","a cool person","a geek","a person who wants to help","a sleepy boy","a lazy person","a f**ker","an as***le"};
		System.out.println("I am "+you_are_what[(int) (Math.random()*(you_are_what.length))]);
	}	
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s