so the program wants me to output the a word based on what the punctuation the user used to end the sentence.
This is what i have so far, i know its really bad...
This is what i have so far, i know its really bad...
Code:
public class punctuation
{
public static void main(String[] args)
{
int sentence, length, even=%2, odd=%1;
char question=?, exclamation=!, other=.;
System.out.println("Enter a sentence.");
sentence = SavitchIn.readLineInt();
int length = sentence.length()
if ( length == even , question)
System.out.println("YES");
else (sentence%1 == odd, question)
System.out.println("NO");
if (exclamation)
System.out.println("WOW");
if (other)
System.out.println("You always say" + sentence);
System.out.println("Press enter key to end program.");
String junk;
junk = SavitchIn.readLine();
}
}
Comment