I need a fresh set of eyes on this code

Hi! My code is working, it’s not giving me any error messages, but the code I put in is not working correctly. This assignment is a magpie lab activity so I am constantly checking it over and over again when I make even the slightest change, but it still isn’t working.

Here’s the link.
I put help in a comment over the sections that won’t work. Please and thank you!!!

1 Like

Welcome to the forums!


The following line uses psn + 9 as the argument for the substring() method. I think you mean to use psn + 5.

String restOfStatement = statement.substring(psn + 9).trim();


int psnOfYou = findKeyword (statement, "you", 0);
int psnOfMe = findKeyword (statement, "me", psnOfYou + 3);

String restOfStatement = statement.substring(psnOfYou + 3, psnOfMe).trim();

First off, when assigned psnOfMe a value, why is the second argument passed to findKeyword() "me"? I think you’ve mixed up "I <something> you" and "Why do you <something> me?" in your head. After realizing this mix-up, try rewriting the assignment statement for restOfStatement.

Happy coding!

1 Like