Exercise
Vowel - if
Objetive
Write a java program to ask the user for a symbol and respond if it's a vowel (in lowercase), a digit, or any other symbol, using "if".
Example Code
import java.util.*;
public class Main
{
public static void main(String[] args)
{
char symbol;
System.out.print("Enter a symbol: ");
symbol = (char)new Scanner(System.in).nextLine();
if ((symbol == 'a') || (symbol == 'e') || (symbol == 'i') || (symbol == 'o') || (symbol == 'u'))
{
System.out.println("It's a lowercase vowel.");
}
else if ((symbol >= '0') && (symbol <= '9'))
{
System.out.println("It's a digit.");
}
else
{
System.out.print("It's another symbol.");
}
}
}