Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 theList, String letter)

{..}

public static int count(Stack theStack, String letter) {}

public static int count(Queue theQueue, String letter)

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

What does stickiest refer to in regard to social media

Answered: 1 week ago