Jump to content

Recommended Posts

I couldn't find anything in the rules against this and figured this would be the appropriate area. I'm coding a program to count vowels for my java class and have an issue when I try to compile or run my program.

package hello;
import java.util.Scanner;
public class Vowel {
	public static void main(String[] args)
	{
		int vowel = 0;
		Scanner scanner = new Scanner(System.in);
		String prompt = "Please enter the phase in which you wish to have the vowels counted:";
		String output = "The phrase you entered contains the following number of vowels: ";
		System.out.println(prompt);
		String test = scanner.nextLine();
		
		for  (int s = 0; s < test.length(); s++);
		{
			char v = test.charAt(s);
			if(v =='a'|| v == 'e' || v == 'i' || v == 'o' || v == 'u' );
			{ vowel++;
				}
		}
				System.out.println(output + vowel);
				
			
			
		


		
	}
	}

My "s" keeps going out of scope and I'm not sure why, any suggestions ?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Who's Online   1 Member, 0 Anonymous, 1451 Guests (See full list)

×
×
  • Create New...