超级专家术语学习机
发布于: 2020 年 07 月 06 日
好,数啤酒瓶不算是真正的应用程序,如果要给老板看很棒的程序,那就把专家术语学习机程序秀出来。注意:当你自已输入这个程序时,不要在字符串中间换行(也就是“”符号之间)不然的话程序无法通过编译程序。
public class PhraseOMatic { public static void main (String [] args){ //可以加上其他术语 String[] wordListOne = {"24/7" , "multiTier","30,000 foot" , "B-to-B","win-win" ,"front-end","web-based" , "pervasive", "smart", "six-sigma" ,"critical-h","dynamic"}; String[] wordListTwo = { "empowered","sticky" ,"value-added" ,"oriented", "centric" ,"distributed","clustered","branded","outside-the-box" , "posi tioned","networked" , " focused","leveraged" ,"aligned" ,"targeted","shared","cooperative" ,"accelerated"}; String[] wordListThree = { "process","tipping-point" , "solution"," architecture" , "core competency","strategy", "mindshare" ,"portal", "space" ,"vision" ,"paradigm", "mission"}; //计算每一组有多少个名词术语 int ontLength = wordListOne.length; int twoLength = wordListTwo.length; int threeLength = wordListThree.length; //产生随机数字 int rand1 = (int) (Math.random() * ontLength); int rand2 = (int) (Math.random() * twoLength); int rand3 = (int) (Math.random() * threeLength); //组合出专家术语 String phrase = wordListOne[rand1] + " " + wordListTwo[rand2] + " " + wordListThree[rand3]; //输出 System.out.println(" What we need is a "+phrase); }}
每次运行编译会出现不一样的重组:
第一次运行结果What we need is a multiTier aligned tipping-point第二次运行结果What we need is a front-end cooperative mindshare
学习心得:random()这个方法会返回介于0与1之间的值。
划线
评论
复制
发布于: 2020 年 07 月 06 日 阅读数: 31
程李文华
关注
还未添加个人签名 2019.10.07 加入
还未添加个人简介
评论