Advertisement
Guest User

Untitled

a guest
Oct 8th, 2015
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class PA4b {
  4.  
  5. public static void main(String[] args) {
  6. Scanner scanner = new Scanner(System.in);
  7.  
  8. System.out.println("Enter your birth month (1-12): ");
  9. int month = scanner.nextInt();
  10. if(month < 1 | month > 12)
  11. {
  12. System.out.println("Invalid month.");
  13. System.exit(0);
  14. }
  15. else
  16. {
  17. System.out.println("Enter your birth day (1-31): ");
  18. int day = scanner.nextInt();
  19. if(day < 1 | day > 31)
  20. {
  21. System.out.println("Invalid day.");
  22. System.exit(0);{
  23. }
  24. if(month == 3 && day >= 21 || month == 4 && day <= 19)
  25. {
  26. System.out.println("You are an Aries!");
  27. }
  28. else if(month == 4 && day >= 20 || month == 5 && day <= 20)
  29. {
  30. System.out.println("You are an Taurus!");
  31. }
  32. else if(month == 5 && day >= 21 || month == 6 && day <= 21)
  33. {
  34. System.out.println("You are an Gemini!");
  35. }
  36. else if(month == 6 && day >= 22 || month == 7 && day <= 22)
  37. {
  38. System.out.println("You are an Cancer!");
  39. }
  40. else if(month == 7 && day >= 23 || month == 8 && day <= 22)
  41. {
  42. System.out.println("You are an Leo!");
  43. }
  44. else if(month == 8 && day >= 23 || month == 9 && day <= 22)
  45. {
  46. System.out.println("You are an Virgo!");
  47. }
  48. else if(month == 9 && day >= 23 || month == 10 && day <= 22)
  49. {
  50. System.out.println("You are an Libra!");
  51. }
  52. else if(month == 10 && day >= 23 || month == 11 && day <= 21)
  53. {
  54. System.out.println("You are an Scorpio!");
  55. }
  56. else if(month == 11 && day >= 22 || month == 12 && day <= 21)
  57. {
  58. System.out.println("You are an Sagittarius!");
  59. }
  60. else if(month == 12 && day >= 22 || month == 1 && day <= 19)
  61. {
  62. System.out.println("You are an Capricorn!");
  63. }
  64. else if(month == 1 && day >= 20 || month == 2 && day <= 18)
  65. {
  66. System.out.println("You are an Aquarius!");
  67. }
  68. else if(month == 2 && day >= 19 || month == 3 && day <= 20)
  69. {
  70. System.out.println("You are an Pisces!");
  71. }
  72. System.out.println("Tony Stark will buy out your business.");
  73. System.exit(0);}
  74. }
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement