WHEN MATHEMATICS MEETS PROGRAMMING-a java code for calculating birthday

in programming •  7 years ago 

package charles;
import java.util.Scanner;
class bool {
public static void main(String args[]) {

@SuppressWarnings("resource")
Scanner bool=new Scanner(System.in);
int DW,D,Y,M,F,A,C=2017;
System.out.println("please enter the day you were born: ");
D=bool.nextInt();
System.out.println("please enter the month you were born: ");
M=bool.nextInt();
System.out.println("please enter the year you were born: ");
   Y=bool.nextInt();
   //USING ZELLER FORMULER
    DW=(((D+(13*((M+9)%12+1)-1)/5
        +Y%100
        +Y%100/4
        +Y/400
        -2*(Y/100))%7+7)%7+1);
System.out.println("THE DAY OF THE WEEK YOU WERE BORN IS: " +DW);
System.out.println();
if (((Y%4)==0)&&((Y%100)!=0)||((Y%400)==0)){
System.out.println("YOU WERE BORN ON A LEAP YEAR ");
}else{
    System.out.println("YOU WERE NOT BORN ON A LEAP YEAR ");    
}
System.out.println();
A=C-Y;
System.out.println("YOUR AGE IS: " +A);
System.out.println();
System.out.println("REMEMBER,1:SUNDAY ");
System.out.println("REMEMBER,2:MONDAY ");
System.out.println("REMEMBER,3:TUESDAY ");
System.out.println("REMEMBER,4:WEDNESDAY ");
System.out.println("REMEMBER,5:THURSDAY ");
System.out.println("REMEMBER,6:FRIDAY ");
System.out.println("REMEMBER,7:SATURDAY ");
System.out.println();
System.out.println("THANKS FOR YOUR CO-OPERATION ");
System.out.println("I STILL REMAIN MY HUMBLE SELF IGAH CHARLES ONYEMA.BYE ");
System.out.println();
System.out.println();
System.out.println("PLEASE DESCRIBE THIS PROGRAM,ALSO INDICATE IF IT WAS HELPFUL OR NOT: ");
F=bool.nextInt();

}
}

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

But, aren't some programmers great mathematicians themselves? We wouldn't have got so many complex algorithms if it wasn't for them. Hell, we wouldn't have even got blockchain...