about | help | code help+videos | done | prefs |
Write a method that takes a sentence and modifies the sentence so that if it says "guilty" it will now say "not guilty." You will need to check that "not guilty" is not already in the sentence. Preconditions: You may assume that all letters lowercase. This problem is not producing correct results if you try to concatenate the strings (i.e. use addition and substrings). If you use the replace method (demo-ed earlier this week) your code will probably work! notGuilty("Are you guilty?") → "Are you not guilty?" notGuilty("You are kind") → "You are kind" notGuilty("I am not guilty") → "I am not guilty" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 100
Copyright Nick Parlante 2017 - privacy