write my assignment 25513

“Create a Java program that allows users to enter multiple sentences and revises the sentences by replacing certain negative words with positive words. The users can enter multiple whitespaces between words, DO NOT alter their spacing if the users use multiple whitespaces. DO NOT use arrays, regEx, replaceAll() and split() String method and import java.io.*. Go through character by character to locate each token. Use as many additional methods as it is needed to assist with the work.”

Specification:

1. Four target words: 1) Replace “fake” with “ingenious” 2) Replace “ugly” with “gorgeous” 3) Replace “strange” with “extraordinary” 4) Replace “unintelligent” with “quick-witted”

2. Do not convert embedded words: If the users embeds the negative words in other words, like “faker”, “stranger”, “unintelligently”, DO NOT convert the embedded words.

3. Adjusts the “a” and “an” if they appear before a target word: If the users enter “He is a fake person. He is an ugly person. He is a strange person. He is an unintelligent person.”, the sentences should be converted to “He is an ingenious person. He is a gorgeous person. He is an extraordinary person. He is a quick-witted person.” DO NOT change the “a” and “an” if they do not appear before a target word.

4. If the user enter something strange like “aN ugLY person”, convert the replacement words to lowercase like “a gorgeous person” (Assume that the replacement word would never appear as the first word of a sentence)

SAMPLE RUN:

(User enters) He is so faKE!!! You cannot find a faker person. I think a fake person is annoying.

Revised text: He is so ingenious!!! You cannot find a faker person. I think an ingenious person is annoying.

(User enters) He is AN UGLY person. He is so UNINTELLIGENT. He behaves strangely.

Revised text: He is a gorgeous person. He is so quick-witted. He behaves strangely.

(User enters) He is An ugly person. (if the user enters five whitespaces between “An” and “ugly”)

Revised text: He is a gorgeous person. (keep the five whitespaces between “a” and “gorgeous”)

 
"Not answered?"
Get the Answer