Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class jhutfless_Numerology
- {
- public static void main(String[] args)
- {
- int m,d,y,total,x,num;
- char sym;
- Scanner input = new Scanner(System.in);
- System.out.print("enter the birth date (mm/dd/yyyy):");
- m = input.nextInt();
- sym = input.next().charAt(0);
- d = input.nextInt();
- sym = input.next().charAt(0);
- y = input.nextInt();
- if(m<1||m>12||y<1880||y>2280||sym!='/'||m==2)
- x=44;
- else
- {
- x=45;
- }
- do
- {
- while(m<1||m>12)
- {
- System.out.printf("Bad month:%d\n",m);
- System.out.print("Enter birth date (mm/dd/yyyy:");
- m =input.nextInt();
- sym =input.next().charAt(0);
- d =input.nextInt();
- sym =input.next().charAt(0);
- y=input.nextInt();
- }
- while(sym!='/')
- {
- System.out.print("Use forward slashes between mm/dd/yyy!\n");
- System.out.print("enter birth date (mm/dd/yyy):");
- m =input.nextInt();
- sym =input.next().charAt(0);
- d =input.nextInt();
- sym =input.next().charAt(0);
- y =input.next().charAt(0);
- }
- while(y<1880||y>2280)
- {
- System.out.printf("Bad year for %d\n",y);
- System.out.print("Enter birth date(mm/dd/yyy):");
- m =input.nextInt();
- sym =input.next().charAt(0);
- d =input.nextInt();
- sym =input.next().charAt(0);
- y =input.nextInt();
- }
- while(m==4||m==6||m==9||m==11)
- {
- if(d<1||d>30)
- {
- System.out.printf("Bad day for %d]n",m,y,d);
- System.out.print("Enter birth date (mm/dd/yyy);");
- m =input.nextInt();
- sym =input.next().charAt(0);
- d =input.nextInt();
- sym =input.next().charAt(0);
- y =input.nextInt();
- }
- }
- while(m==2)
- {
- if(y%4==0||y%400==0||y==2000)
- {
- if(d<1||d>29)
- System.out.printf("bad day for %d/%d?%d:\n",m,d,y);
- System.out.print("Enter birth date (mm/dd/yyy):");
- m =input.nextInt();
- sym =input.next().charAt(0);
- d =input.nextInt();
- sym =input.next().charAt(0);
- y =input.nextInt();
- }
- if(y%4!=0||y%100==0||y%400!=0||y!=2000)
- {
- if(d<1||d>28)
- System.out.printf("bad day for %d/%d/ : %d\n",m,y,d);
- System.out.print("Enter birthdate (mm/dd/yyyy/):");
- m =input.nextInt();
- sym =input.next().charAt(0);
- d =input.nextInt();
- sym =input.next().charAt(0);
- y =input.nextInt();
- }
- }
- }
- while(x==44);
- if(x==45)
- {
- System.out.printf("Welcome to the numerology report for %d/%d/%d:\n",m,d,y);
- total = m+d+y;
- do
- {
- total=((total%10)+(total/10));
- }
- while(total>=10);
- num=total;
- switch(num)
- {
- case 1:
- System.out.println("Good things are to come");
- break;
- case 2:
- System.out.println("Live free die hard");
- break;
- case 3:
- System.out.println("Sad day");
- break;
- case 4:
- System.out.println("Tommorow is a new day");
- break;
- case 5:
- System.out.println("Rainy today is");
- break;
- case 6:
- System.out.println("Wonders await!");
- break;
- case 7:
- System.out.println("Someone Loves you");
- break;
- case 8:
- System.out.println("Soothe thy senses");
- break;
- case 9:
- System.out.println("Don't feel bad");
- break;
- }
- }
- }
- }
- 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