Assignment #105
Code
/*
jack newsom
period 5
program Evenness
filename Evenness.java
date completed 11/9/2015
*/
public class Evenness
{
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