Assignment 105, Evenness Method
Code
///Name: Stella Koliavas
///Period: 5
///Program Name: Evenness
///File Name: Evenness.java
///Date Finshed: 4/28/16
import java.util.Scanner;
public class Evenness
{
public static void main( String[] args )
{
for ( int n = 1 ; n <= 20 ; n = n+1 )
{
if ((isThree(n) == true) && (isEven(n) == true))
System.out.println(n + "<=");
else if (isEven(n) == true)
System.out.println(n + "<");
else if (isThree(n) == true)
System.out.println(n + "=");
else
System.out.println(n);
}
}
public static boolean isEven( int n )
{
boolean result;
if ( n%2 == 0 )
result = true;
else
result = false;
return result;
}
public static boolean isThree( int n )
{
boolean result;
if ( n%3 == 0 )
result = true;
else
result = false;
return result;
}
}
Picture of the output