Computer Science, asked by studylove75, 7 months ago

Write The Java Program to check Vowel or Consonant using Switch Case
(I Want This Full Program In Written Type) Thank You! ​

Answers

Answered by sneha2006bgp
3

Answer:

Explanation:

/* Program to check if entered character is vowel or not using Switch Case*/

import java.util.*;

class SwitchVowel

{

public static void main()

{

Scanner inp=new Scanner(System.in);

System.out.print("\n Enter Character: ");

char c=((inp.nextLine()).charAt(0));

char z=Character.toUpperCase(c); //Changing Value to UpperCase for uniformity.

switch(z) //Checking Vowel Character using Switch Case

{

case 'A':

case 'E':

case 'I':

case 'O':

case 'U': System.out.println(c+" is a Vowel.");

break;

default: System.out.println(c+" is a Non-Vowel Character.");

}

}

}

Answered by manofsteel4535
4

Algorithm:

1. Enter and Store User Input.

2. Duplicate the input and store it.

3. Change the Case of the duplicate for lesser comparison and uniformity.

4. Pass the input through Switch-Case construct.

5. Check for Vowel.

6. Print the Result accordingly.

Program You Wanted In Written Type:

/* Program to check if entered character is vowel or not using Switch Case*/

import java.util.*;

class SwitchVowel

{

public static void main()

{

Scanner inp=new Scanner(System.in);

System.out.print("\n Enter Character: ");

char c=((inp.nextLine()).charAt(0));

char z=Character.toUpperCase(c); //Changing Value to UpperCase for uniformity.

switch(z) //Checking Vowel Character using Switch Case

{

case 'A':

case 'E':

case 'I':

case 'O':

case 'U': System.out.println(c+" is a Vowel.");

break;

default: System.out.println(c+" is a Non-Vowel Character.");

}

}

}

Hope it helps you and if you liked my answer you can mark it a brainliest...

Similar questions