Check vowels with switch


Saturday, November 11, 2023 Difficulty: Easy

Objective

Create a Java program that prompts the user for a letter (x) and checks whether it is a vowel or any other symbol. The program should display "Vowel" on the screen if the input is a vowel (a, e, i, o, u) and "Other symbol" if it''s any other character.

Input

a

Output

Vowel

Solution

Click here to view the exercise solution

Share it

Share it on your social media and challenge your friends to solve programming problems. Together, we can learn and grow.

Copied

The code has been successfully copied to the clipboard.

More Exercises

Continue improving your Java programming skills with our selection of practical exercises from the lesson. Click on Practice and challenge your knowledge!

1

Basic calculator using if

Java basic calculator. Input numbers and operators (+, -, x, /) for calculation. If the symbol is not valid, it displays 'Character not recognized'.

2

ABS - Absolute value

Calculate and display the absolute value of a number in Java with this programming exercise on conditions.

3

Basic calculator using switch

Basic calculator with switch for mathematical operations. Allows decimal numbers and error handling. Practice your skills in Java.

4

Positive and negative

Learn Java: Detect whether a number is positive or negative in this programming exercise. Enhance your Java skills.

5

Check vowels with switch

Create a Java program that prompts the user for a letter (x) and checks whether it is a vowel or any other symbol.

6

boolean and conditional operator

Create a Java program that uses the conditional operator to assign value to a boolean variable.

7

The largest of three numbers

Java exercise to find the largest number among three and practice Java conditions.

8

Conditional operator

9

Nested conditional operator

Create a Java program that prompts the user to enter two integers (a, b) and determines how many of them are positive using nested conditional operators in Java.

10

Switch, break, and default

Calculate a student's grade using a switch statement in Java based on an integer input. Practice using switch, break, and default.

Flow controls: Conditions

Practice with exercises in Java related to the conditions, loops and structures of the language.

Practice exercises

Keep learning

C# Programming Course

Free programming course with practical exercises and solutions in C#. Start learning right now!

Exercises C# App

Take your Exercises C# lessons everywhere with our Android app. Download it now from Google Play