Assignment #105 and Evenness Method
Code
/// Name: Trent Lane
/// Period: 6
/// Program Name: Evenness Functon
/// Date Finished: 3/11/2016
public class Evenness
{
public static boolean isEven( int n )
{
if ( n % 2 == 0)
return true;
else
return false;
}
public static boolean isDivisibleBy3 ( int n )
{
if ( n % 3 == 0)
return true;
else
return false;
}
public static void main ( String[] args )
{
for ( int x = 1 ; x <= 20 ; x++ )
{
System.out.print( x + " ");
if ( isEven(x) == true && isDivisibleBy3(x) == true )
System.out.println("<=");
else if ( isEven(x) == true )
System.out.println("<");
else if ( isDivisibleBy3(x) == true )
System.out.println("=");
else
System.out.println();
}
}
}
Picture of the output