-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvowel.java
More file actions
26 lines (24 loc) · 947 Bytes
/
Copy pathvowel.java
File metadata and controls
26 lines (24 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/** Author: Anand A Jain
* Date: 25-07-2025
* Input a character and use a switch statement to determine if it's a vowel or a consonant.
*/
import java.util.Scanner;
public class vowel {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter the Character");
char alphabet = in.next().charAt(0);
switch(Character.toLowerCase(alphabet)) {
case 'a': case 'e': case 'i': case 'o': case 'u':
System.out.println("The character is a vowel");
break;
default:
if(alphabet >= 'a' && alphabet <= 'z' || alphabet >= 'A' && alphabet <= 'Z') {
System.out.println("The character is a consonant");
} else {
System.out.println("The character is not an alphabet");
}
}
in.close();
}
}