Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1.  
  2. package java.recursive.sentence.generator;
  3. import java.lang.Math;
  4.  
  5. public class JavaRecursiveSentenceGenerator {
  6.  
  7. static void Sentence() {
  8. //Follows the rule to implement <Sentence> ::= simple sentence
  9. simpleSentence();
  10.  
  11. // 50% of sentences continue with yet another sentence
  12. if (Math.random() > 0.50) {
  13. System.out.print(" and ");
  14. simpleSentence();
  15. }
  16. }
  17.  
  18. static void simpleSentence() {
  19. System.out.println("a simp");
  20. }
  21. public static void main(String[] args) {
  22.  
  23. String[] properNouns = { "Fred", "Jane", "Richard Nixon", "Miss America" };
  24. String[] commonNouns = { "man", "woman", "fish", "elephant", "unicorn" };
  25. String[] adjectives = {"big", "tiny", "pretty", "bald"};
  26. String[] determiner = {"a", "the", "very", "some"};
  27. String[] intransitiveVerb = {"runs", "talks", "jumps", "sleeps"};
  28. String[] transitiveVerb = {"loves", "hates", "sees", "knows", "looks for", "finds"};
  29. String[] conjunction = {"and", "or", "but", "because"};
  30.  
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement