Assignment #105

Code

    /// Name: Matthew Lorence
    /// Period: 5
    
    public class EvennessFunction
    {
        
        public static void main ( String[] args )
        {
            
            for ( int n = 0; n <= 20; n = n + 1 )
            {
                
                if ( isEven(n) == true && isDivisibleBy3(n) == false )
                    System.out.println( n + " " + "<" );
                else if ( isEven(n) == false && isDivisibleBy3(n) == true )
                    System.out.println( n + " " + "=" );
                else if ( isEven(n) == true && isDivisibleBy3(n) == true )
                    System.out.println( n + " " + "<=" );
                else
                    System.out.println( n );
            }
        }
        
        
        public static boolean isEven( int n )
        {
            int num = n;
            
            boolean evenBoolean;
            
            if ( num%2 == 0 )
                evenBoolean = true;
            else
                evenBoolean = false;
            
            return evenBoolean;
        }
        
        public static boolean isDivisibleBy3( int n )
        {
            int num = n;
            
            boolean threeBoolean;
            
            if ( num%3 == 0 )
                threeBoolean = true;
            else
                threeBoolean = false;
            
            return threeBoolean;
        }
        
    
    }

        
        
    

Picture of the output

Assignment 105