i have to write a java program to print any inputted character if it is lowercase vowel or consonant, then if it is uppercase vowel or consonant, if it is not, print it to special character..
this is the code, please help me.. i'm not yet done with this code
class Input
{
public static void main(String[] args)
{
boolean vowel = false;
System.out.print("Enter an alphabet letter (A through Z : ");
char letter = < a_letter > // Input.class needed to enter a 'char'
switch(letter)
{
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
vowel = true;
break;
default:
vowel = false;
break;
}
if (vowel)
System.out.println(letter + " is a vowel.");
else
System.out.println(letter + " is a consonant");
}
}
my errors are,
Input.java:9: error: illegal start of expression
switch(letter)
^
Input.java:9: error: not a statement
switch(letter)
^
Input.java:9: error: ';' expected
switch(letter)
^
Input.java:11: error: orphaned case
case 'A':
^
kindly help me to finis my code.. thanks a lot in advance..

New Topic/Question
Reply



MultiQuote








|