I need help with the program I am doing.
I am writing a 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 even number of characters, then output the word "yes". If the sentence ends with a question mark and the input contains odd number of characters, then ouput the word "No". If the input sentence ends with an exclamation mark then output the word "Wow". In all other cases the program will output the string "You always say" followed by the input string enclosed in quotes. The output should be on one line.
The program has to be done in System.out.println
This is what i have so far but it doesnt work I am having trouble mainly with the if/else.
public class Questions
{
public static void main(String[] args)
{
string even, odd, exclamationMark, other;
System.out.println("Enter a phrase:"
if(even == 0 || ?)
{
System.out.println("yes"
}
else if(odd == 1 || ?)
{
System.out.println("No"
}
else if(!);
{
System.out.println("Wow"
}
else System.out.println(\""You always say" + other \"
even = SavitchInreadLineString();
odd = SavitchInreadLineString();
exclamationMark = SavitchInreadLineString();
other = SavitchIn.readLineString();
}
}
I am writing a 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 even number of characters, then output the word "yes". If the sentence ends with a question mark and the input contains odd number of characters, then ouput the word "No". If the input sentence ends with an exclamation mark then output the word "Wow". In all other cases the program will output the string "You always say" followed by the input string enclosed in quotes. The output should be on one line.
The program has to be done in System.out.println
This is what i have so far but it doesnt work I am having trouble mainly with the if/else.
public class Questions
{
public static void main(String[] args)
{
string even, odd, exclamationMark, other;
System.out.println("Enter a phrase:"
if(even == 0 || ?)
{
System.out.println("yes"
}
else if(odd == 1 || ?)
{
System.out.println("No"
}
else if(!);
{
System.out.println("Wow"
}
else System.out.println(\""You always say" + other \"
even = SavitchInreadLineString();
odd = SavitchInreadLineString();
exclamationMark = SavitchInreadLineString();
other = SavitchIn.readLineString();
}
}