Question: q1-q5 q4: Write a public static method named q4 that takes a String as a parameter and returns * an int. The return value is
q4: Write a public static method named q4 that takes a String as a parameter and returns * an int. The return value is the total number of times "1" and "p" appear in the input * String *Hint: If the second argument of the replace method is th matching characters will be * removed (Replaced with nothing) * See (https://docs.oracle.com/Java se/8/docs/api/java/lang/String .html#method. summary) for a * complete list of methods contained in the String class. You may call any of these methods * in your method kak * q5: Write a public static method named q5 that takes a String as a parameter and returns a *String. The returned String is based on the input String as follows: *If the input String has no characters, return "empty" If the input String has less than 3 characters, return "short * If the input String has 3 or more characters but less than 8, return "medium" If the input String has greater than or equal to 8 characters, return "long" If the input String contains any instances of the letterq', return "found q" regardless * of the length of the input
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
