Advertisement
Guest User

Untitled

a guest
Nov 20th, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. public class Speaker {
  2. public static void main (String[] args) {
  3. String[] wordListOne = {"What's up","Hello","Good day","Good morning"};
  4. String[] wordListTwo = {"Sir","Brah","Miss","Mom"};
  5. String[] wordListThree = {"How are you?","Are you okay?","Let's play!","How you sleep?"};
  6. int oneListLength = wordListOne.length;
  7. int twoListLength = wordListTwo.length;
  8. int threeListLength = wordListThree.length;
  9. int randomListOne = (int) (Math.random()*oneListLength);
  10. int randomListTwo = (int) (Math.random()*twoListLength);
  11. int randomListThree = (int) (Math.random()*threeListLength);
  12. String phrase = wordListOne[randomListOne]+" "+wordListTwo[randomListTwo]+" "+wordListThree[randomListThree];
  13. System.out.println("generated greetings - "+phrase);
  14.  
  15. }
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement