Write a program that reads a one-line sentence as input and then displays the following response: If the sentence ends with a question mark (?) and the input contains an even number of characters, display the word Yes. If the sentence ends with a question mark and the input contains an odd number of characters, display the word No. If the sentence ends with an exclamation point (!), display the word Wow. In all other cases, display the words You always say followed by the input string enclosed in quotes. Your output should all be on one line. Be sure to note that in the last case, your output must include quotation marks around the echoed input string. In all other cases, there are no quotes in the output. Your program does not have to check the input to see that the user has entered a leg
This project requires a three-way selection statement and gives more practice with string methods. The case statement can be used since the control expression is a single character, and, in fact, that is what the solution in this manual uses. It may be instructive to show the code using if/else, instead, and compare them for readability. This project will be extended to use a loop in the next chapter.
ee the code in AskOrTellMeSelection.java.
You might also like to view...
What is the name of the cloud-based storage that is automatically included for free when a Microsoft account is created?
A. Windows Store B. Microsoft Cloud C. OneDrive D. WindowsDrive
Preview the chart in ________ view before you print to ensure a balanced printout
Fill in the blank(s) with correct word
The Clipboard group, which contains the Cut button, can be found on the Home ribbon
Indicate whether the statement is true or false
A(n) ________ is used to guide a user through complex tasks by asking a series of questions and may ask more questions after the user clicks Next
A) collection B) PIN C) app D) wizard