KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
As I said before, how do I test if the entered character is one of the parameters? I've written this code, but it doesn't seem to run very well(or at all), no errors, however. Also, I need to use the basic code I've used here. Its for school and we lose points if we use things they haven't taught us (darn school). class doody { public static void main(String[] args) { char i; char input='D'; for(i='A';i<='Z';i++)//check if uppercase { if(input==i){ System.out.println("Uppercase"); switch(input){ case 'A': case 'E': case 'I': case 'O': case 'U': System.out.println("Vowel"); break; default: System.out.println("Not a vowel"); break;} } for(i='a';i<='z';i++)//check if lowercase { if(input==i){ System.out.println("Lowercase"); switch(input){ case 'a': case 'e': case 'i': case 'o': case 'u': System.out.println("Vowel"); break; default: System.out.println("Not a vowel"); break; }} for(i='0';i<='9';i++)//check if number { if(input==i) System.out.println("Number"); } } }}} Edit: Here is some code I threw together today. Much simpler. I don't know why this didn't occur to me earlier. It was probably because I was groggy, it was late. class doody { public static void main(String[] args) { char input='$';//input here. boolean lorn=false; if(input>='a'&&input<='z') {System.out.println("Lowercase"); lorn=true; if(input=='a')System.out.println("Vowel."); if(input=='e')System.out.println("Vowel."); if(input=='i')System.out.println("Vowel."); if(in
Tags (comma-separated)
Save Edits
Cancel