Question
The java program is a conversation. 1. If the user input contains the word because and there is something after because other than spaces or
The java program is a conversation.
1. If the user input contains the word "because" and there is something after "because" other than spaces or punctuation marks, respond with "Is "
1.a Start by taking what came after the user input following "because". For example, "Late because ...my car stalled!!" becomes " ...my car stalled!!".
1.b Strip off leading and trailing punctuation marks and spaces. For example, " ...my car stalled!!" becomes "my car stalled"
1.c Switching first and second person pronouns and possesives. For example, "my car stalled" becomes "your car stalled" ( In other cases, "your" switch to "my"; "I" switch to " you"; "you" switch " I "; "me" switch "you"; "you" switch to "me"; "mine" switch "yours"; "yours" switch "mine".
2. Otherwise, if the input contains an even number of words, respond with "Tell me more."
3. Else, respond with "Whatever."
4.If input is nothing(hitting enter) , output is "Bye for now"
Example dialogue:
Talk to me, or hit enter to quit: This is interesting
Whatever.
Talk to me, or hit enter to quit: This is so interesting
Tell me more.
Talk to me, or hit enter to quit: I always say that just because.
Tell me more.
Talk to me, or hit enter to quit: I always say that just because!
Tell me more.
Talk to me, or hit enter to quit: Because my life is short.
Is "your life is short" the real reason?
Talk to me, or hit enter to quit: Maybe not, sometimes I'm confused
Whatever.
Talk to me, or hit enter to quit: ???!!!
Whatever.
Talk to me, or hit enter to quit:
Bye for now
Could you help giving me on this? I am really stuck. Try not to use advanced java method. So far I just learn loops; substring; replace; charAt; contains and so on.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started