Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Java for this maven project as well as junit testing DO NOT add any folders or change the structure of the project in anyway.

image text in transcribed

Use Java for this maven project as well as junit testing DO NOT add any folders or change the structure of the project in anyway. DO NOT alter the pom.xml file. Create a generic abstract class called GenericList This class will contain only two data fields: Node head (this is the head of the list and should be private). int length (the length of the list and should be private) This class should include the following methods: print(): prints the items of the list, one value per line. If the list is empty, print "Empty List". add(I data): adds the value to the list. This method is abstract since the implementation depends on what the data structure is. public I delete(): returns the first value of the list and deletes the node. If the list is empty, return null. public ArrayList dumpList(): this method stores and returns all values currently in the list into an ArrayList and returns it. At the end of this method, your list should be empty. getLength() setLength() getHead() setHead(), these are getters/setters for private data members head and length. This class should also define a generic inner class Node: It will include two fields: T data and Nodenext; ***This class encapsulates a linked list. Defining a Node class and providing two methods that a queue and stack have in common while leaving adding a node to each implementation that inherits from it. *** Create two more classes Generic Queue and Generic Stack. They both should inherit from GenericList. The constructors for each class will take one parameter. That parameter will be a value that will go in the first node of the list encapsulated by each instance of the class. Each constructor should initialize the linked list head, with the value passed in by the constructor. Each class should also implement the method add(l data), GenericQueue will add to the back of the list while Generic Stack will add to the front. Each class must also keep track of the length of it's list using the length data field defined in the abstract class

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

Step: 3

blur-text-image

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

IBM Db2 11 1 Certification Guide Explore Techniques To Master Database Programming And Administration Tasks In IBM Db2

Authors: Mohankumar Saraswatipura ,Robert Collins

1st Edition

1788626915, 978-1788626910

More Books

Students also viewed these Databases questions

Question

(1) How many levels and factors are there in this example? Pg45

Answered: 1 week ago