Skip to content

Commit

Permalink
chore:finish p4
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonGamerBot-QK committed Sep 18, 2024
1 parent 2c03128 commit fa8b2fc
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions projects/Magpiev2ActivityStarterCode/activity4/Magpie4b.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,18 @@ private String transformWouldYouLikeStatement(String statement)
String restOfStatement = statement.substring(psn + 9).trim();
return "When would you like me to " + restOfStatement + " with you?";
}

/**
* Take a statement with "I don't like <something>." and transform it into
* "You said 'I dislike <something>'? What don't you like about it?"
* @param statement the user statement, assumed to contain "I don't like"
* @return the transformed statement
*/
private String transformIDontLikeStatement(String statement)
{
// Your code goes here

return "You said 'I dislike " + statement.substring(12) + "'? What dont you like about it?"; // Modify this statement to return the correct String
}
/**
* Take a statement with "I want to <something>." and transform it into
* "What would it mean to <something>?"
Expand Down Expand Up @@ -160,7 +171,7 @@ public String getResponse(String statement)
} else if (findKeyword(statement, "I want to", 0) >= 0) {
response = transformIWantToStatement(statement);
} else if (findKeyword(statement, "i dont like")>=0) {
response = "You said 'I dislike " + statement.substring(12) + "'? What dont you like about it?";
response = transformIDontLikeStatement(statement);
} else if (findKeyword(statement, "you dont like")>=0) {
response = "You said I dislike " + statement.substring(12) + ". Why would you think that!";
}
Expand All @@ -171,7 +182,7 @@ public String getResponse(String statement)

if (statement.contains("dog")) {
response = replaceWord(statement, "dog", "cat");
}
}

// return response;
// Responses which require transformations
Expand Down

0 comments on commit fa8b2fc

Please sign in to comment.