Question
Using the provided code (practice.java), write the method getVowelCount, found in the provided code, that counts every vowel in a linked list of Strings and
Using the provided code (practice.java), write the method getVowelCount, found in the provided code, that counts every vowel in a linked list of Strings and returns said count. The letters considered to be vowels are a, e, i, o, and u, and the case does not matter. Also, you may assume that all String data is not null, and the String will only contain letters, and not digits or special characters.
practice.java:
public class practice
{
public class ListNode//public for testing purposes
{
public String data;//public for testing purposes
public ListNode link;//public for testing purposes
public ListNode(String aData, ListNode aLink)
{
data = aData;
link = aLink;
}
}
public ListNode head;//public for testing purposes
public int getVowelCount()
{
//-----------------------------------------------------------------------------------
//Write your solution here
}//Do not alter this
//Write additional methods or properties here
//--------------------------------------------------------------------------------
//Solution Tests
public void test01()
{
head = new ListNode("aaaa",
new ListNode("bbbb",
new ListNode("CCCC",
new ListNode("dddd",
new ListNode("EeEe",null)))));
}
public void test02()
{
head = new ListNode("hey",
new ListNode("Everyone",
new ListNode("HOW",
new ListNode("goes",
new ListNode("IT",null)))));
}
public void test03()
{
head = new ListNode("R",
new ListNode("S",
new ListNode("T",
new ListNode("L",
new ListNode("N",null)))));
}
public static void main(String[] args)
{
//Example
System.out.println("Test01");
Question02 q2 = new Question02();
q2.test01();
int vowelCount = q2.getVowelCount();
System.out.println(vowelCount);
System.out.println(" Test02");
q2.test02();
vowelCount = q2.getVowelCount();
System.out.println(vowelCount);
System.out.println(" Test03");
q2.test03();
vowelCount = q2.getVowelCount();
System.out.println(vowelCount);
//Printing Results
}
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