// This program generates a numerology report from a birthdate import java.util.Scanner; public class Numerology { public static void main ( String args[] ) { Scanner i = new Scanner ( System.in ); int month, day, year; char char1, char2; int check = 0; int number; do { System.out.print("Enter the birth date (mm/dd/yyyy): "); month = i.nextInt(); char1 = i.next() .charAt(0); day = i.nextInt(); char2 = i.next() .charAt(0); year = i.nextInt(); if ( month>12 || month<1 ) { System.out.printf("Bad month: %d\n", month); continue; } if ( char1!='/' || char2!='/') { System.out.println("Use forward slashes between mm/dd/yyyy!"); continue; } if ( day<1 || day>31) { System.out.printf("Bad day: %d\n", day); continue; } if ((month==9 || month==4 || month==6 || month==11) && day>30) { System.out.printf("Bad day: %d\n", day); continue; } if (month == 2) { if (year%4==0 && ((year%100==0 && year%400==0) || (year%100!=0)) && day>29) { System.out.printf("Bad day: %d\n", day); continue; } else if (day>28 && ((year%4!=0) || (year%4==0 && year%100==0 && year%400!=0))) { System.out.printf("Bad day: %d\n", day); continue; } } if (year>2280 || year<1880) { System.out.printf("Bad year: %d\n", year); continue; } check = 1; } while(check==0); number = month + day + year; while (number>9) { number = number%10 + number/10; } System.out.printf("Welcome to the numerology report for %d%c%d%c%d :\n" , month, char1, day, char2, year); switch (number) { case 1: System.out.printf(":%d: Do or do not. There is no try.\n", number); break; case 2: System.out.printf(":%d: There will be kitties in your future!\n", number); break; case 3: System.out.printf(":%d: You will be blessed with health.\n", number); break; case 4: System.out.printf(":%d: Your faith is unshakeable.\n", number); break; case 5: System.out.printf(":%d: If you are going through hell, keep going.\n", number); break; case 6: System.out.printf(":%d: People love being around you!\n", number); break; case 7: System.out.printf(":%d: Love conquers all.\n", number); break; case 8: System.out.printf(":%d: Free your mind and the rest will follow\n", number); break; case 9: System.out.printf(":%d: Never give up!\n", number); break; } } }