Question
Please help with this java assignment! Write three methods that will return a LinkedList, Stack, and Queue containing the following poem. Each word is an
Please help with this java assignment!
Write three methods that will return a LinkedList, Stack, and Queue containing the following poem. Each word is an element in the LinkedList, Stack, or Queue.
Hickory, dickory, dock. The mouse ran up the clock. The clock struck one and down he runs. Hickory, dickory, dock.
The header of each method is:
public static LinkedList
Then, write 3 methods that will return an int with the number of times that a word occurred in the linked list, queue, and stack. Before leaving each method, restore the structure that was passed, if it was destroyed in the process of reading it. The headers of these methods are:
public static int count(LinkedList
public static int count(Stack
Within main:
Call the following 3 methods:
LinkedList
Print theList, theStack, and theQueue: System.out.println(Before..);
System.out.println(theList);
System.out.println(theStack);
System.out.println(theQueue);
Ask the user to enter any word in the poem, and store it in a String variable named aWord.
Call each of the following methods:
int countLL = count(theList, aWord);
int countStack = count(theStack, aWord);
int countQueue = count(theQueue, aWord);
Display a message of how many times aWord occurred in theList, theStack, & theQueue.
Repeat step b.) to re-print the list, stack, and queue, preceded by the title After.
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