Question: Write a class named Consonants with the following: . A private default constructor. A public static method named consonantRepeat, which takes a String parameter named
Write a class named Consonants with the following: . A private default constructor. A public static method named consonantRepeat, which takes a String parameter named strand an int named n and returns a string. The method should return a string that is composed of n repetitions of all the consonants in str. You may only use StringBuilder methods and wrapper classes. You may not use concatenation. If there are no consonants, return an empty string. Some examples of the method being used are provided below. Method Usage Returned Value String strl = consonants.consonantRepeat ("banana", 3); "bnnnnnn" string str2 = consonants.consonantRepeat ("OOF!", "FFFF" 4) string str3 = consonants.consonantRepeat ("aieee", 2)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
