Java code Write a class called TextAnalyzer that in addition

Java code

Write a class called TextAnalyzer that, in addition to main, has two functions, one called countVowels, and the other called countWords. countVowels takes in a string and returns the number of vowels in it. countWords takes in a string and returns the number of words in it.

Then write a class called TextAnalyzerTest that uses the JUnit framework to test the functions countVowels and countWords for TextAnalyzer.

Solution

Note: To run test class you need to add junit.jar in your classpath /** * FileName:TextAnalyzer.java */ public class TextAnalyzer { /** * @param word * @return */ public static int countVowels(String word){ int count=0; for(int i=0;i
Java code Write a class called TextAnalyzer that, in addition to main, has two functions, one called countVowels, and the other called countWords. countVowels t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site