Created
October 17, 2013 03:44
-
-
Save TheLouisHong/7018951 to your computer and use it in GitHub Desktop.
Martino'w HW
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class CharCheck { | |
public static void main(String[] args) { | |
Scanner keyboard = new Scanner(System.in); | |
System.out.println("Begin!"); | |
while (true) { | |
char input = keyboard.next().charAt(0); | |
if (isDigit(input)){ | |
System.out.println("It's a Digit"); | |
} | |
if (isUpperCase(input)){ | |
System.out.println("It's a Uppsercase"); | |
} | |
if (isLowerCase(input)){ | |
System.out.println("It's a Lowercase"); | |
} | |
if (isVowel(input)){ | |
System.out.println("It's a is Vowel"); | |
} | |
if (isConsonent(input)){ | |
System.out.println("It's a Consonent"); | |
} | |
} | |
} | |
public static boolean isDigit(char input) { | |
return Character.isDigit(input); | |
} | |
public static boolean isUpperCase(char input) { | |
return Character.isUpperCase(input); | |
} | |
public static boolean isLowerCase(char input) { | |
return Character.isLowerCase(input); | |
} | |
// a,e,i,o,u | |
public static boolean isVowel(char input) { | |
if (input == 'a' || input == 'e' || input == 'i' || input == 'o' || input == 'u') { | |
return true; | |
} | |
return false; | |
} | |
public static boolean isConsonent(char input) { | |
if (input == 'a' || input == 'e' || input == 'i' || input == 'o' || input == 'u'||isDigit(input)) { | |
return false; | |
} | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment