Question
I would like some help in completing this exercise. Thank You public class WordLib { /** * This method takes a token (a space-separated letter
I would like some help in completing this exercise. Thank You
public class WordLib {
/** * This method takes a token (a space-separated letter sequence in the book * data) and return a new string that does not contain any of the symbols listed * below. That is, it removes the symbols from the word. * * Symbols to be removed: , . ? ; ! : ' " ( ) _ \u201C \u201D * * The \u201C and \u201D are the left and right double quotation marks in * Unicode. * * @param w * a token read from the book * @return a string without the listed symbols */ public static String cleanWord(String w) { throw new UnsupportedOperationException("replace with your implementation"); }
/** * This method takes a token (a space-separated letter sequence in the book * data) and return a new array of words when the token contains two words * separated by double dashes. Assume that no token contains two double dashes * (e.g., hello--world--houston) or has triple dashes. * * If "hello--world" is the input, a new array of length 2 must be returned * where the first and the second element of the array are "hello" and "world", * respectively. There are edge cases. For example, "Hello--" or "--World". For * such cases, the first and/or the second element of the new array will have an * empty string. * * If the input does not contain a double dash, the first array element will has * the input token as-is and the second element will be set to an empty string. * * @param w * a token read from the book * @return an array of words */ public static String[] splitDash(String w) { throw new UnsupportedOperationException("replace with your implementation"); }
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started