Question: Write a program that prompts the user to enter a letter and checks whether the letter is a vowel or a constant. You will prompt
"Write a program that prompts the user to enter a letter and checks whether the letter is a vowel or a constant."
You will prompt the user: "Enter a letter: " each time, your analysis output will be either... C is a consonant C is a vowel C is an invalid input
in each case C is the character just read. For user input you will be ignoring the new-line character.
NetBeans Sample Run (User manually enters z, A, e, E, ", and d; then click terminate red button)
run: Enter a letter: z z is a consonant Enter a letter: A A is a vowel Enter a letter: e e is a vowel Enter a letter: # # is an invalid input Enter a letter: " " is an invalid input Enter a letter: d d is a consonant
run: Enter a letter: A is a vowel Enter a letter: Z is a consonant Enter a letter: # is an invalid input Enter a letter: e is a vowel Enter a letter: z is a consonant Enter a letter: BUILD SUCCESSFUL (total time: 0 seconds)
Nota Bene, in the second sample run we have hard coded the data into the Scanner constructor, make sure for submit you read from "Standard" input, (aka System.in). Data for all assignment unless specified else wise is free form format. Free form format is white space separated. A white space is either space, tab or newline. The default delimiter for Scanner is white space.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
