Question: IN JAVA Write an interactive program Named FavoriteLetter using do...while statement that accepts a favorite letter represented as a one-letter String as input. The program
Write an interactive program Named FavoriteLetter using do...while statement that accepts a favorite letter represented as a one-letter String as input. The program then repeatedly prompts the user to enter a word until two consecutive words are entered that start with that letter. The program then prints a message showing the last word typed. You may assume that the user will type a single-word response to each prompt. Your code should be case-sensitive; for example, if the favorite letter is a, you should not stop prompting if the user types words that start with an A. For example, the following logs represent the output from two runs of the program (User input is underlined.) 2. FavoriteLetter ("y") FavoriteLetter ("A") Output, wordsnInfarrowo-V"- wordin?nfarrowo TAT- utput words in a row. Type a word: hi Type a word: bye Type a word: Type a word: What? Type a word: Tvpe a word: "y" is for "yipp words in a row Type a word: I Type a word: Iove Type a word: cSET42! type a word: AND Type a word: PROGRAMS Type a word: are Type a word: always Type a word: Absolutel Type a word: Awesome yellOw
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
