Page 1 of 1

Write a Java program which asks user to enter a character. If the character entered is a vowel, then it should print tha

Posted: Sun Jul 10, 2022 11:31 am
by answerhappygod
Write A Java Program Which Asks User To Enter A Character If The Character Entered Is A Vowel Then It Should Print Tha 1
Write A Java Program Which Asks User To Enter A Character If The Character Entered Is A Vowel Then It Should Print Tha 1 (63.23 KiB) Viewed 77 times
Write a Java program which asks user to enter a character. If the character entered is a vowel, then it should print that it is vowel, otherwise it should print, it is a consonant. Use Switch statement to write your program. The switch statement should be used such that least number of break statements are present in switch. NOTE: Every student must enter his/her own name and student id at the start of program as shown in output. (Hint 1: A, E, I, O, U, a, e, i, o u are vowels.) (Hint 2: You can use letter input.next().charAt(0); to get character from user) Output Please enter your name: Please enter your Student id: Please enter a character: A (taken from user) (taken from user) This is a vowel. // A is used just for reference here. In your case, user must be able to enter // character at runtime. Specifications Get input from user in the form of character using Scanner class. (Marks 2) • Use Switch statement to print out if the character entered by user is vowel or consonant.