Forgive me I am new to programming, but thoroughly enjoy what I have learned so far. So my question is; I am trying to write a program that prompts the user to enter a letter, then returns whether the letter is a vowel or a consonant. Problem is I can not get it to accept a letter input. It will accept it if forced to as in "user_input = 'a'". But not as an option. I know am missing something simple.
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int user_input;
System.out.print("Enter a letter: ");
user_input = in.nextInt();//<--line of error
if (user_input == 'a')
{
System.out.println("Vowel");
}
else if (user_input =='e')
{
System.out.println("Vowel");
}
else if (user_input =='i')
{
System.out.println("Vowel");
}
else if (user_input =='o')
{
System.out.println("Vowel");
}
else if (user_input =='u')
{
System.out.println("Vowel");
}
else
{
System.out.println("Consonant");
}
}
Thank you ahead of time for your time.