Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. public class nurseryRhymes
  2. {
  3. private String frogs;
  4. private String frogs2;
  5. private String monkeys;
  6. private String hdd;
  7. private String hdd2;
  8.  
  9. /*
  10. * default constructor
  11. */
  12. public nurseryRhymes()
  13. {
  14. frogs = "little speckled frogs, nsitting on a speckled log, neating the most delicious bugs, nyum, yum, none jumped into the pool, nwhere it is nice and cool, nnow there are";
  15. frogs2 = "little speckled frogs! nribbit, ribbit n";
  16. monkeys = "little monkeys jumping on the bed, nOne fell off and bumped his head, nMama called the doctor, nAnd the doctor said,nNo more monkeys jumping on the bed";
  17. hdd = "Hickory Dickory dock, The mouse ran up the clock, nThe clock struck,";
  18. hdd2 = "nThe mouse ran down, nHickory Dickory dock.";
  19. }
  20.  
  21. public String getFrogs()
  22. {
  23. return frogs;
  24. }
  25. public String getFrogs2()
  26. {
  27. return frogs2;
  28. }
  29. public String getMonkeys()
  30. {
  31. return monkeys;
  32. }
  33. public String getHdd()
  34. {
  35. return hdd;
  36. }
  37. public String getHdd2()
  38. {
  39. return hdd2;
  40. }
  41. public String toString()
  42. {
  43. return frogs + frogs2 + monkeys + hdd + hdd2;
  44. }
  45. }
  46.  
  47. import java.io.*;
  48. import java.util.*;
  49. public class FullNurseryRhymes
  50. {
  51. public static void main(String[] args)
  52. {
  53. nurseryRhymes rhymes = new nurseryRhymes();
  54.  
  55. for(int i = 3; i >= 1; i--)
  56.  
  57. System.out.print(i + nurseryRhymes.getFrogs() + i + nurseryRhymes.getFrogs2());
  58.  
  59.  
  60. //Your code here to print out lyrics for 10 little monkeys from 10 to 1
  61.  
  62. //Or any of your own choices in decrementing pattern
  63.  
  64. //Your code here to print Hickory Dickory Dock strike 1 to 12
  65.  
  66. //Or any of your own choices in incrementing pattern
  67.  
  68. //Your code here to check if baby is sleeping while ABCs (your own
  69.  
  70. //choices) is played continuously (see next assignment ABCs)
  71.  
  72. }
  73. }
  74.  
  75. nurseryRhymes.getFrogs()
  76.  
  77. rhymes.getFrogs()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement