Question
Could you please help me with this java code Write 3 methods that will return the number of times that a word begins with a
Could you please help me with this java code
Write 3 methods that will return the number of times that a word begins with a given letter in the linked list, queue, and stack. Ensure the structure is passed to each method, along with the letter that we are searching for.
public static int count(LinkedList
{..}
public static int count(Stack
public static int count(Queue
within main:
create a linked List, Stack, and Queue of Strings, where each word below comprises an element/node in the linkedList, Stack, or Queue:
Roses are red, violets are blue. Sugar is sweet and so are you.
Display the poem to the user, and ask him/her to enter a word in the poem.
Find that words that begin with the letter s within the linked list, stack and queue, by making 3 different method calls:
count(linked list), count(stack), count(queue)
Display the result of each method call (i.e. the count of how many times the word occurred in your linked list, stack, or queue).
Ensure the structure is left in its original state (or put back).
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