Assignemnt #106 and Prime Numbers

Code

/// Name: Kyle Ivy
/// Period: 5
/// Program Name: CallingMethodsFromOtherFiles
/// File Name: CallingMethodsFromOtherFiles.java
/// Date Finished: 4/20/2016

    import java.util.Scanner;

    public class CallingMethodsFromOtherFiles
    {
        public static void main( String[] args ) 
        {
            Scanner keyboard = new Scanner(System.in);
            
           
            System.out.println( "All you have to do is enter your birthday, and this program will tell you the day of the week on which you were born. " );
            
            System.out.println(" Some automatic tests... " );
            System.out.println( " 12 10 2003 => " + weekday( 12, 10, 2003 ) );
            System.out.println( "  2 13 1976 => " + weekday( 2, 13, 1976 ) );
            System.out.println( "  2 13 1977 => " + weekday( 2, 13, 1977 ) );
            System.out.println(" 7  2 1974 => " + weekday( 7, 2, 1974 ) );
            System.out.println(" 1 15 2003 => " + weekday( 1, 15, 2003 ) );
            System.out.println("10 13 2000 => " + weekday( 10, 13, 2000 ) );
            System.out.println();
            
            System.out.println( "Now it's your turn! What's your birthday? " );
            System.out.print( "Birthday (mm dd yyyy): " );
            int mm = keyboard.nextInt();
            int dd = keyboard.nextInt();
            int yyyy = keyboard.nextInt();
            
            System.out.println( "You were born on " + weekday( mm, dd, yyyy ) + "!" );
        }
        
        public static String weekday( int mm, int dd, int yyyy )
            {
                int yy = yyyy - 1900;
                int total, leftover;
                String date = "";
                total = (yy/4) + yy + dd + MonthOffset.monthOffset(mm);
        
                if ( bleh.isLeap(yyyy) == true && ( mm == 1 || mm == 2 ) )
                    total = total - 1;
                
            
                leftover = total%7 ;
                leftover = leftover - 1;
            
                date = bleh.WeekdayName(leftover) + ", " + MonthName.monthName(mm) + ", " + yyyy;
            
                return date;
            }
    }
    
    

prog106.PNG

Assignment 1