Write a program that prompts the user to provide a single character from the alp
ID: 3628955 • Letter: W
Question
Write a program that prompts the user to provide a single character from the alphabet. Print "vowel", or "consonant" depending on the user input. The program prints "error" if-the user input is not a letter (between a and z, or A and Z), or
-the user input is a string of length>1
Explanation / Answer
What language are you writing it in? The logic/outline of the program for any language is as follows: //Remember to include any classes/libraries that you need print "enter a character"; get the character from the input; if(character length is > 1 OR || character isn't a letter ex: isalpha(character) for C++ or character.isLetter() for Java, etc.)) print "error"; if( character == "a" OR character == "A" OR character == "e" OR character == vowel etc.) print "vowel"; else print "consonant"; Hope this helps.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.