We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a01f31c commit f17a9a6Copy full SHA for f17a9a6
1 file changed
Section7ConditionalStatements/src/SwitchCodeCC.java
@@ -0,0 +1,31 @@
1
+/* Write a program that takes a lowercase English alphabet character as input and uses a 'switch' statement to
2
+determine if it's a Vowel or Consonant. */
3
+
4
+import java.util.Scanner;
5
6
+class SwitchCodeCC {
7
+ public static void main(String[] args) {
8
+ Scanner scanner = new Scanner(System.in);
9
+ char ch = scanner.next().charAt(0);
10
11
+ switch (ch) {
12
+ case 'a':
13
+ System.out.println("Vowel");
14
+ break;
15
+ case 'e':
16
17
18
+ case 'i':
19
20
21
+ case 'o':
22
23
24
+ case 'u':
25
26
27
+ default:
28
+ System.out.println("Consonant");
29
+ }
30
31
+}
0 commit comments