Assignement: 105 Using Methods to Indicate Certain Numbers
Code
/// Name: Sean Harrison
/// Period: 7
/// Program name: EvennessMethod
/// File Name: EvennessMethod.java
/// Date Finished: 4/1/2016
public class EvennessMethod
{
public static void main( String[] args )
{
for (int x = 0; x < 20; x++)
{
System.out.println((x + 1) +" "+ (isEven(x + 1) ? "<" : "") + (isDiv3(x+1)? "=":"") );
}
}
public static boolean isEven(int n)
{
return (n%2==0);
}
public static boolean isDiv3(int n)
{
return (n%3==0);
}
}
Picture of the output