Question 4:
Question 04: (03 marks)
The interface TextProcessor below is already given in Java code format, thus you can use it without creating an TextProcessor.java file:
6 of 6
Paper No: 1
<<interface>>
TextProcessor
+ remove Whitespace(input:String):String
+ countVowels(input:String):int
Write a class named TextProcessorImpl, which implements the interface TextProcessor. The class TextProcessorImpl implements all methods in TextProcessor as below:
+ remove Whitespace(input: String): String - return the string input with all whitespace characters
removed.
+ countVowels (input: String):int - return the number of vowels of the string input (no case sensitive)
Hints: You can refer to the methods: split(), contains(), indexOf(), trim(), replaceAll(), toCharArray() of the String class
Close
+ 100%
Zoom