Write Method Named Swearfilter String Text String Swear Takes Two Parameters String Contai Q37154148

Write a method named swearFilter(String text, String[] swear)that takes two parameters: a String containing some text, and anarray of Strings containing a list of “swear words”. Your methodwill return a String containing the text contained in the firstString, where each “swear word” is replaced by its first character,followed by a number of stars equal to its number of charactersminus two, followed by its last character. For example, if theswear words are “duck”, “ship”, and “whole”, and the text containsthe following story: A duck was sailing on a ship shipping wholewheat bread. Duck that SHIP!!! Your method would return: A d**k

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.