Hello,
I'm writing a program that creates repetitions of a section of a word.
I'm trying to get the program to evaluate the data i send to the tester method, and return true or false depending on whether or not it is a valid input.
import java.util.Scanner;
public class WordRepeater
{
public static void main (String []args)
{
Scanner input = new Scanner(System.in);
System.out.println( "please input a word with an even number of letters" );
String word = input.nextLine();
System.out.println("please an even number less that or equal to twenty");
int reps = input.nextInt();
System.out.print( word);
System.out.println( reps);
boolean pass = tester(word, reps);
//System.out.print( pass );
}
public boolean tester (String Word1, int Reps1)
{
boolean check = true;
if (Word1.length() % 2 == 0) {}
else if (Word1.length() % 2 != 0) check = false;
if (Reps1 % 2 == 0) {}
else if (Reps1 % 2 != 0) check = false;
return check;
}
}
However, i get am error saying that the non-static method tester cannot be referenced from a static context.
I'm out of practice in java, having not done it the last half- year, so i cannot figure oiut where i went wrong.
any advice would be well appreciated