OLD - 일/Java

Java - 자동구문 생성기 예제

평범한직장인 토끼씨 2014. 2. 18. 10:36

//난수를 발생하여 각 배열이 있는 단어들을 조합하여 출력하는 자동구문 생성기


public class exam {

public static void main(String[] args)

{

String[] wordOne = {"24/7","multi-Tier", "30,000 foot","B-to-B","win-win","front-end","web-based","pervasive","smart","six-sigma","critical-path","dynamic"};

String[] wordTwo = {"empowered","sticky","valued-added","oriented","centric","distributed","clustered","branded","outside-the-box","positioned","networked","focused","leveraged","aligned","targeted","shared","cooperative","accelerated"};

String[] wordThree = {"process","tipping-point","solution","architecture","core competency","startegy","mindshare","portal","space","vision","paradigm","mission"};

int onelen = wordOne.length;

int twolen = wordTwo.length;

int threelen = wordThree.length;

int rand1 = (int)(Math.random() * onelen);

int rand2 = (int)(Math.random() * twolen);

int rand3 = (int)(Math.random() * threelen);

String phrase =wordOne[rand1] + " " + wordTwo[rand2] + " " + wordThree[rand3];

System.out.println("What we need is a " + phrase);

}

}