ok so here is goes heres the question

Write a JAVA program that takes a one-line sentence as input and then outputs the following response: If the sentence ends with a question mark ‘?’ and the input contains an even number of characters, then output the word “Yes”. If the sentence ends with a question mark ‘?’ and the input contains an odd number of characters, output the word “No”. In all other cases, your program will output the string “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.

i am completely lost ive looked in the text book for some tips to solving this problem and ive come up empty handed if anyone has any tips on approaching this problem it would be appreciated

10 Years
Discussion Span
Last Post by peter_budo
  1. Write a program which is able retrive input from user and store it in string
  2. Look up method which will tell you the length of that string, length also will help to find if number of character is even or odd
  3. Look up method which is able to get you character from position i in the string and check if it is question mark
  4. Based on previous findings you can generate equivalent output
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.