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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!