WHY AM I GETTING THIS ERROR?
zyLabsUnitTest.java:12: error: cannot find symbol
int numChars = CharCount.countCharacters("Muddy buddy");
symbol: method countCharacters(String)
location: class CharCount
zyLabsUnitTest.java:19: error: cannot find symbol
numChars = CharCount.countCharacters("Eat on");
symbol: method countCharacters(String)
location: class CharCount
zyLabsUnitTest.java:26: error: cannot find symbol
numChars = CharCount.countCharacters("Welcome to the only Eaton Rapids on Earth.");
symbol: method countCharacters(String)
location: class CharCount
3 errors
_______________________________________________________________
here is my code:
import java.util.Scanner;
public class CharCount {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter text: ");
String a = input.nextLine();
CharCount cc = new CharCount();
int count = cc.countcharacters(a);
System.out.println("The string contains " + count + " ETAON's.");
}
int countcharacters(String a)
{
int i;
int c = 0;
a = a.toLowerCase();
for(i = 0; i < a.length(); i++)
{
char ch = a.charAt(i);
if(ch == 'e' || ch == 'a' || ch == 't' || ch == 'o' || ch == 'n')
{
c++;
}
}
return c;
}
}