Question: Write a program in Java that reads a one-line sentence and then displays the following response: If the sentence ends with a question mark (?)
Write a program in Java that reads a one-line sentence and then displays the following response:
If the sentence ends with a question mark (?) and the input contains an even number of characters (including the ?) display the word Yes.
If the sentence ends with a question mark (?) and the input contains an odd number of characters (including the ?) display the word No.
If the sentence ends with an exclamation point (!) display the word Wow.
In all other cases display You always say followed by the input string in quotes.
Sample input: output:
Is today Monday? Yes
Will it rain today? No
Mickey Mouse! Wow
I like programming. You always say I like programming.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
