Assignemnt #105 and Evenness Method
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: Evenness Method
///File Name: EvennessMethod
///Date Finished: 3/10/16
public class EvennessMethod
{
public static void main( String args[] )
{
for ( int n = 1; n <= 20; n=n+1 )
{
isEven( n );
isDivisibleBy3( n );
if( isEven( n ) == true && isDivisibleBy3( n ) == true)
{
System.out.println(n + "<=");
}
else if( isEven( n ) == true )
{
System.out.println(n + "<");
}
else if( isDivisibleBy3( n ) == true )
{
System.out.println(n + "=");
}
else
{
System.out.println(n);
}
}
}
public static boolean isEven( int n )
{
boolean value;
value = ( n % 2 == 0 );
return value;
}
public static boolean isDivisibleBy3( int n )
{
boolean value;
value = ( n % 3 == 0 );
return value;
}
}
Picture of the output