Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java: The Node Class The Node class represents one Node of your LinkedList. The Node class must be Generic with three different type parameters.

In Java:

The Node Class

The Node class represents one "Node" of your LinkedList. The Node class must be Generic with three different type parameters. The Generic types could each be different, so you cannot use the same generic label for each type. An example of what I mean is demonstrated in the following Node instantiation:

Node myNode = new Node<>(42, "book", 5.67);

Also note that it is possible for the type parameters to be the same as well:

Node node = new Node(27, "blue", "musician");

Be sure to design the generics of your Node class accordingly.

The following defines the requirements for the Node class. You are not allowed to change / add / omit anything in the requirements.

Member Variables

This class shall have one member variable called category1 which will store information related to the first grouping category. This data field shall be generic and shall have package-level access.

This class shall have one member variable called category2 which will store information related to the second grouping category. This data field shall be generic and shall have package-level access.

This class shall have one member variable called category3 which will store information related to the third grouping category. This data field shall be generic and shall have package-level access.

This class shall have one member variable called right which is a pointer to the next item in the main list. This data field shall have package-level access.

This class shall have one member variable called left which is a pointer to the previous item in the main list. This data field shall have package-level access.

This class shall have one member variable called down which is a pointer to the next item in the sub-list This data field shall have package-level access.

No other member variables are allowed.

Constructor

This class shall have one constructor which has parameters to initialize the three category data fields.

No other constructors are allowed.

Methods:

This class shall have getters and setters for each of the three category variables.

NOTE: That all Node instantiation and manipulation will be done within your LinkedList class. The types for the parameters will also come from the corresponding generic parameters in the LinkedList class. Nodes will NOT be instantiated in any classes OTHER than LinkedList.

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

Students also viewed these Databases questions

Question

4. Explain the strengths and weaknesses of each approach.

Answered: 1 week ago