Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Cannot find symbol error in vowel count program

$
0
0
So im trying to get my code to compile but each time i get an error saying "cannot find symbol" and "char cannot be dereferenced". I have no clue on why this keeps popping up. Any suggestions?

	public static void main(String[]args)
	{
		Scanner keyboard = new Scanner(System.in);
		
		int a_count = 0;
		int e_count = 0;
		int i_count = 0;
		int o_count = 0;
		int u_count = 0;
		int i = 0;
		char inputchar;
		char cont;
		char input;
		String inputext;
		
			//input
			System.out.print("Enter a line of text: ");
			inputext = keyboard.nextLine();
			
		do
		{
			for ( ; i < inputext.length; i++)
			{
				inputchar = inputext.charAt(i);
				
				if( inputchar == 'A' || inputchar == 'a')
				{
					a_count++;
				}
				
				if( inputchar == 'E' || inputchar == 'e')
				{
					e_count++;
				}
				
				if ( inputchar == 'I' || inputchar == 'i')
				{
					i_count++;
				}
				
				if ( inputchar == 'O' || inputchar == 'o')
				{
					o_count++;
				}
				if ( inputchar == 'U' || inputchar == 'u')
				{
					u_count++;
				}
				
			}//end for
			
			System.out.print("Would you like to enter another line of text? (Y/N): ");
			cont = input.nextLine();
			
		}while(cont == 'Y' || cont == 'y');
		
		//gets value of vowels
		System.out.println("A: " + a_count);
		System.out.println("E: " + e_count);
		System.out.println("I: " + i_count);
		System.out.println("O: " + o_count);
		System.out.println("U: " + u_count);
		
	}
}


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>