Guest User

Untitled

a guest
Nov 19th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.23 KB | None | 0 0
  1. Exception in thread "main" java.lang.NullPointerException
  2. at SwamiBuckner.getHoroscope(SwamiBuckner.java:144)
  3. at demoSwamiBuckner.main(demoSwamiBuckner.java:25)
  4.  
  5. public String getHoroscope()
  6. {
  7. switch(sign)
  8. {
  9. case "Aries":
  10. horoscope = "Your energy is off the charts today! This almost ensures that you'll have a great day, thanks to your madcap approach to life.";
  11. break;
  12. case "Taurus":
  13. horoscope = "Your energy is up today. You're resourceful by nature, and now you're especially so. You've got the guts and the creativity to do just about anything you want -- so make it good!";
  14. break;
  15. case "Gemini":
  16. horoscope = "You're in high spirits today, and your impulsive streak is a mile wide. Your friends and family know you well enough to know that when you're like this, they should just stand back, because you're a force of nature!";
  17. break;
  18. case "Cancer":
  19. horoscope = "You're strong of mind and heart today. If you're required to take charge of a group or situation, you should have little trouble -- except that other people are in touch with their inner authorities now, too.";
  20. break;
  21. case "Leo":
  22. horoscope = "Your creativity swells today. Maybe it's your high energy, or maybe it's just your willingness to try something new without worrying how it might end up.";
  23. break;
  24. case "Virgo":
  25. horoscope = "Your creativity swells today. Maybe it's your high energy, or maybe it's just your willingness to try something new without worrying how it might end up.";
  26. break;
  27. case "Libra":
  28. horoscope = "Some brash energy is flying around today. People are in unusually independent moods. You might wish everyone could just get along, but don't expect that to happen.";
  29. break;
  30. case "Scorpio":
  31. horoscope = "Your temper is set to simmer today, which means it could flare easily with just the smallest of sparks. What's more, you see little reason to hold yourself back from speaking your mind.";
  32. break;
  33. case "Sagittarius":
  34. horoscope = "Your individualist streak flares to life today. Whatever you're passionate about, use the current energy burst to pursue it ardently. Spirited efforts are favored now.";
  35. break;
  36. case "Capricorn":
  37. horoscope = "Watch how you speak to people today, especially your children, students, teammates or employees. The current cosmic energy makes you less sensitive than usual to others' feelings.";
  38. break;
  39. case "Aquarius":
  40. horoscope = "Today your interest in a person or subject is sparked. Suddenly, you're filled with ardent enthusiasm. Your blood is humming -- in your excitement, you might literally hear it rushing in your ears!";
  41. break;
  42. case "Pisces":
  43. horoscope = "Try not to be thin-skinned today. The current energy leaves no room for sensitivity. People are in bold, even aggressive moods, so they probably aren't looking out for your feelings.";
  44. break;
  45. default:
  46. System.out.println("getHoroscope error");
  47. break;
  48. }
  49.  
  50. return horoscope;
  51. }
  52.  
  53. System.out.println(name1 + ", Swami says: " + swam1.getHoroscope());
  54.  
  55. public String getSign()
  56. {
  57. switch(month)
  58. {
  59. case 01:
  60. if (day >= 01 && day <= 19)
  61. sign = "Capricorn";
  62. else if (day >= 20 && day <= 31)
  63. sign = "Aquarius";
  64. break;
  65.  
  66. case 02:
  67. if (day >= 01 && day <= 18)
  68. sign = "Aquarius";
  69. else if (day >= 19 && day <= 28)
  70. sign = "Pisces";
  71. break;
  72.  
  73. case 03:
  74. if (day >= 01 && day <= 20)
  75. sign = "Pisces";
  76. else if (day >= 21 && day <= 31)
  77. sign = "Aries";
  78. break;
  79.  
  80. case 04:
  81. if (day >= 01 && day <= 19)
  82. sign = "Aries";
  83. else if (day >= 20 && day <= 30)
  84. sign = "Taurus";
  85. break;
  86.  
  87. case 05:
  88. if (day >= 01 && day <= 20)
  89. sign = "Taurus";
  90. else if (day >= 21 && day <= 31)
  91. sign = "Gemini";
  92. break;
  93.  
  94. case 06:
  95. if (day >= 01 && day <= 21)
  96. sign = "Gemini";
  97. else if (day >= 22 && day <= 30)
  98. sign = "Cancer";
  99. break;
  100.  
  101. case 07:
  102. if (day >= 01 && day <= 22)
  103. sign = "Cancer";
  104. else if (day >= 23 && day <= 31)
  105. sign = "Leo";
  106. break;
  107.  
  108. case 8: //fix this
  109. if (day >= 01 && day <= 22)
  110. sign = "Leo";
  111. else if (day >= 23 && day <= 31)
  112. sign = "Virgo";
  113. break;
  114.  
  115. case 9: //fix this
  116. if (day >= 01 && day <= 22)
  117. sign = "Virgo";
  118. else if (day >= 23 && day <= 30)
  119. sign = "Libra";
  120. break;
  121.  
  122. case 10:
  123. if (day >= 01 && day <= 23)
  124. sign = "Libra";
  125. else if (day >= 24 && day <= 31)
  126. sign = "Scorpio";
  127. break;
  128.  
  129. case 11:
  130. if (day >= 01 && day <= 21)
  131. sign = "Scorpio";
  132. else if (day >= 22 && day <= 30)
  133. sign = "Sagittarius";
  134. break;
  135.  
  136. case 12:
  137. if (day >= 01 && day <= 21)
  138. sign = "Sagittarius";
  139. else if (day >= 22 && day <= 31)
  140. sign = "Capricorn";
  141. break;
  142.  
  143. default:
  144. System.out.println("getSign error");
  145. }
  146.  
  147. return sign;
  148. }
Add Comment
Please, Sign In to add comment