Guest User

Untitled

a guest
Jan 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.86 KB | None | 0 0
  1. public class jhutfless_Numerology
  2. {
  3. public static void main(String[] args)
  4. {
  5. int m,d,y,total,x,num;
  6. char sym;
  7.  
  8. Scanner input = new Scanner(System.in);
  9.  
  10. System.out.print("enter the birth date (mm/dd/yyyy):");
  11.  
  12. m = input.nextInt();
  13. sym = input.next().charAt(0);
  14. d = input.nextInt();
  15. sym = input.next().charAt(0);
  16. y = input.nextInt();
  17.  
  18. if(m<1||m>12||y<1880||y>2280||sym!='/'||m==2)
  19. x=44;
  20. else
  21. {
  22. x=45;
  23. }
  24.  
  25. do
  26. {
  27. while(m<1||m>12)
  28. {
  29. System.out.printf("Bad month:%d\n",m);
  30. System.out.print("Enter birth date (mm/dd/yyyy:");
  31. m =input.nextInt();
  32. sym =input.next().charAt(0);
  33. d =input.nextInt();
  34. sym =input.next().charAt(0);
  35. y=input.nextInt();
  36. }
  37.  
  38. while(sym!='/')
  39. {
  40. System.out.print("Use forward slashes between mm/dd/yyy!\n");
  41. System.out.print("enter birth date (mm/dd/yyy):");
  42. m =input.nextInt();
  43. sym =input.next().charAt(0);
  44. d =input.nextInt();
  45. sym =input.next().charAt(0);
  46. y =input.next().charAt(0);
  47. }
  48.  
  49. while(y<1880||y>2280)
  50. {
  51. System.out.printf("Bad year for %d\n",y);
  52. System.out.print("Enter birth date(mm/dd/yyy):");
  53. m =input.nextInt();
  54. sym =input.next().charAt(0);
  55. d =input.nextInt();
  56. sym =input.next().charAt(0);
  57. y =input.nextInt();
  58. }
  59.  
  60. while(m==4||m==6||m==9||m==11)
  61. {
  62. if(d<1||d>30)
  63. {
  64. System.out.printf("Bad day for %d]n",m,y,d);
  65. System.out.print("Enter birth date (mm/dd/yyy);");
  66. m =input.nextInt();
  67. sym =input.next().charAt(0);
  68. d =input.nextInt();
  69. sym =input.next().charAt(0);
  70. y =input.nextInt();
  71. }
  72. }
  73.  
  74.  
  75. while(m==2)
  76. {
  77. if(y%4==0||y%400==0||y==2000)
  78. {
  79. if(d<1||d>29)
  80. System.out.printf("bad day for %d/%d?%d:\n",m,d,y);
  81. System.out.print("Enter birth date (mm/dd/yyy):");
  82. m =input.nextInt();
  83. sym =input.next().charAt(0);
  84. d =input.nextInt();
  85. sym =input.next().charAt(0);
  86. y =input.nextInt();
  87.  
  88. }
  89. if(y%4!=0||y%100==0||y%400!=0||y!=2000)
  90. {
  91. if(d<1||d>28)
  92. System.out.printf("bad day for %d/%d/ : %d\n",m,y,d);
  93. System.out.print("Enter birthdate (mm/dd/yyyy/):");
  94. m =input.nextInt();
  95. sym =input.next().charAt(0);
  96. d =input.nextInt();
  97. sym =input.next().charAt(0);
  98. y =input.nextInt();
  99. }
  100. }
  101. }
  102.  
  103. while(x==44);
  104.  
  105. if(x==45)
  106. {
  107. System.out.printf("Welcome to the numerology report for %d/%d/%d:\n",m,d,y);
  108. total = m+d+y;
  109.  
  110. do
  111. {
  112. total=((total%10)+(total/10));
  113. }
  114. while(total>=10);
  115. num=total;
  116.  
  117.  
  118. switch(num)
  119. {
  120. case 1:
  121. System.out.println("Good things are to come");
  122. break;
  123. case 2:
  124. System.out.println("Live free die hard");
  125. break;
  126. case 3:
  127. System.out.println("Sad day");
  128. break;
  129. case 4:
  130. System.out.println("Tommorow is a new day");
  131. break;
  132. case 5:
  133. System.out.println("Rainy today is");
  134. break;
  135. case 6:
  136. System.out.println("Wonders await!");
  137. break;
  138. case 7:
  139. System.out.println("Someone Loves you");
  140. break;
  141. case 8:
  142. System.out.println("Soothe thy senses");
  143. break;
  144. case 9:
  145. System.out.println("Don't feel bad");
  146. break;
  147. }
  148.  
  149. }
  150. }
  151. }
  152.  
  153. This is my code now my calculations are off and when i get a bad number it sends me into an infinite loop :(
Add Comment
Please, Sign In to add comment