Methods #105 (So no quotient?...)
Code
/// Name: Amir Salehi
/// Period: 7
/// Program Name: EvennessFunction
/// File Name:EvennessFunction.java
/// Date Finished: 4/11/2016
public class EvennessFunction
{
public static void main( String[] args )
{
System.out.println();
for ( int n = 1; n <= 20; n ++ )
{
if ( isEven(n) == true && isDivisibleBy3(n) == true )
System.out.println( n + " <= " );
else if ( isEven(n) == true && isDivisibleBy3(n) == false )
System.out.println( n + " < " );
else if ( isEven(n) == false && isDivisibleBy3(n) == true )
System.out.println( n + " = " );
else
System.out.println( n );
}
System.out.println();
}
public static boolean isEven( int n )
{
boolean result;
result = ( n%2 == 0 );
return result;
}
public static boolean isDivisibleBy3( int n )
{
boolean result;
result = ( n%3 == 0 );
return result;
}
}
Picture(s) of the output