how to search for upper/lower case using string using JAVA!!!?

eortiz10

Honorable
Sep 24, 2013
1
0
10,510
-I am trying to write a program that will examine each letter in the string and count how many time the upper-case letter 'E' appears, and how many times the lower-case letter 'e' appears.

-I also have to use a JOptionPane.showMessageDialog() to tell the user how many upper and lower case e's were in the string.

-This will be repeated until the user types the word "Stop".

Code:
"
public class Project0 {

	public static void main(String[] args) {
	
		String[] uppercase = {'E'};
		String[] lowercase = {'e'};
		String isOrIsNot, inputWord;
			
		while (true) {
			// This line asks the user for input by popping out a single window
			// with text input
			inputWord = JOptionPane.showInputDialog(null, "Please enter a sentence");
			
			if ( inputWord.equals("stop") )
				System.exit(0);
			
			// if the inputWord is contained within uppercase or 
			// lowercase return true
			if (wordIsThere(inputWord, lowercase)) 
				isOrIsNot = "Number of lower case e's: "; 

			if (wordIsThere(inputword, uppercase))
	 			isOrIsNot = "number of upper case e's: ";
			
			// Output to a JOptionPane window whether the word is on the list or not
			JOptionPane.showMessageDialog(null, "The word " + inputWord + " " + isOrIsNot + " on the list.");
		}
	} //main

	public static boolean wordIsThere(String findMe, String[] theList) {
		for (int i=0; i<theList.length; ++i) {
			if (findMe.equals(theList[i])) return true;
		}
		
		return false;
	} // wordIsThere
} // class Lab4Program1

"