GTU OOP Program - 6

6). Write a program that prompts the user to enter a letter and check whether a letter is a vowel or constant.

import java.util.Scanner;

class Program_06 {
    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        System.out.print("Enter the Character : ");
        char ch = input.next().charAt(0);
        switch (Character.toLowerCase(ch)) {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':
            System.out.print(ch + " is a vowel");
            break;

        default:
            System.out.print(ch + " is a consonant");
            break;
        }
    }
}

Output
cse gtu, gtu study material for computer engineering students gujarat technological university oop lab manual solution

gtu oop lab manual,

oop GTU Practical,

oop Programs,

Object oriented Programming,

Gtu study material 3140705,

OOP 3140705,

oop practical list,

Java Programming,

gtu oop practical,

oop lab solution gtu

Comments

YouTube

Popular posts from this blog

GTU OOP Program - 21

GTU OS Program - 3

GTU OOP Program - 1