Question

Step 2 Develop the following class: Class Name: QueueNode<T> Access Modifier: public Instance variables Name: info...

Step 2

Develop the following class:

Class

Name: QueueNode<T>

Access Modifier: public

Instance variables

Name: info

Access modifier: private

Data type: T (parameterized type)

Name: link

Access modifier: private

Data type: QueueNode<T>

Constructors:

Name: QueueNode

Access modifier: public

Parameters: info (data type T)

Task: sets the value of this.info to the value of the info parameter sets the value of link to null

Methods

Name: setInfo

Access modifier: public

Parameters: info (data type T)

Return type: void

Task: sets the value of this.info to the value of the info parameter

Name: getInfo

Access modifier: public

Parameters: none

Return type: T (parameterized type)

Task: returns the value of info

Name: setLink

Access modifier: public

Parameters: link (data type QueueNode<T>)

Return type: void

Task: sets the value of this.link to the value of the link parameter

Name: getLink

Access modifier: public

Parameters: none

Return type: QueueNode<T>

Task: returns the value of link

0 0
Add a comment Improve this question Transcribed image text
Answer #1
  • The class QueueNote will two instance variable:
    • 1.) T info;
    • 2.) QueueNode<T> link;
  • It will have five methods, let's define them one by one:
    • 1.) the constructor:
      • This class has a parametrized constructor.
      • The constructor takes one argument of type T, and assigns it to info.
      • the link variable is set to null:
      • implementation:

public QueueNode(T i){
       this.info = i;
       this.link = null;
   }

  • 2,) setInfo
    • This is a setter function for info variable. It take a T argument and sets it to info.
    • implementation:

   public void setInfo(T i){
       this.info = i;
   }

3.) getInfo

  • This is a getter function for the variable info. It returns the value of info

   public T getInfo(){
       return this.info;
   }

4.) setLink

  • This is a setter function for the variable link. It takes a QueueNode<T> argument

public void setLink(QueueNode<T> q){
       this.link = q;
   }

5.) getLink

  • This is a getter funciton for the variable link. It return the value of link

public QueueNode<T> getLink(){
       return this.link;
   }

The completer QueueNode class implementation:

public class QueueNode<T> {
   private T info;
   private QueueNode<T> link;
   public QueueNode(T i){
       this.info = i;
       this.link = null;
   }
   public void setInfo(T i){
       this.info = i;
   }
   public T getInfo(){
       return this.info;
   }
   public void setLink(QueueNode<T> q){
       this.link = q;
   }
   public QueueNode<T> getLink(){
       return this.link;
   }
  
}

Add a comment
Know the answer?
Add Answer to:
Step 2 Develop the following class: Class Name: QueueNode<T> Access Modifier: public Instance variables Name: info...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • use intellij idea main java Step 2 Develop the following class: Class Name: QueueNode<T> Access Modifier:...

    use intellij idea main java Step 2 Develop the following class: Class Name: QueueNode<T> Access Modifier: public Instance variables Name: info Access modifier: private Data type: T (parameterized type) Name: link Access modifier: private Data type: Queue Node<T> Constructors: Name: QueueNode Access modifier: public Parameters: info (data type T Task: sets the value of this.info to the value of the info parameter sets the value of link to null Methods Name: link Access modifier: private Data type: QueueNode<T> Constructors: Name:...

  • Step 1 Develop the following interface: Interface Name: QueueInterface<T> Access Modifier: public Methods Name: isEmpty Access...

    Step 1 Develop the following interface: Interface Name: QueueInterface<T> Access Modifier: public Methods Name: isEmpty Access modifier: public Parameters: none Return type: boolean Name: dequeue Access modifier: public Parameters: none Return type: T (parameterized type) Name: enqueue Access modifier: public Parameters: element (data type T, parameterized type) Return type: void Step 2 Develop the following class: Class Name: QueueNode<T> Access Modifier: public Instance variables Name: info Access modifier: private Data type: T (parameterized type) Name: link Access modifier: private Data...

  • Step 1 Develop the following interface: Interface Name: QueueInterface<T> Access Modifier: public Methods Name: isEmpty Access...

    Step 1 Develop the following interface: Interface Name: QueueInterface<T> Access Modifier: public Methods Name: isEmpty Access modifier: public Parameters: none Return type: boolean Name: dequeue Access modifier: public Parameters: none Return type: T (parameterized type) Name: enqueue Access modifier: public Parameters: element (data type T, parameterized type) Return type: void Step 2 Develop the following class: Class Name: QueueNode<T> Access Modifier: public Instance variables Name: info Access modifier: private Data type: T (parameterized type) Name: link Access modifier: private Data...

  • Step 1 Develop the following interface: Interface Name: Queue Interface<T> Access Modifier: public Methods Name: isEmpty...

    Step 1 Develop the following interface: Interface Name: Queue Interface<T> Access Modifier: public Methods Name: isEmpty Access modifier: public Parameters: none Return type: boolean Name: dequeue Access modifier: public Parameters: none Return type: T (parameterized type) Name: enqueue Access modifier: public Parameters: element (data type T, parameterized type) Return type: void Step 2 Develop the following class: Class Name: Queue Node<T> Access Modifier: public Instance variables Name: info Access modifier: private Data type: T (parameterized type) Name: link Access modifier:...

  • Step 3 Develop the following class: Class Name: ImprovedQueue<T> Access Modifier: public Implements: QueueInterface<T> Instance variables...

    Step 3 Develop the following class: Class Name: ImprovedQueue<T> Access Modifier: public Implements: QueueInterface<T> Instance variables Name: front Access modifier: private Data type: QueueNode<T> Constructors: Name: ImprovedQueue Access modifier: public Parameters: none (default constructor) Task: sets the value of front to null Methods Name: isEmpty Access modifier: public Parameters: none Return type: boolean Task: returns true if the front is equal to null; otherwise return false Name: dequeue                           Access modifier: public Parameters: none Return type: T (parameterized type) Task: makes...

  • use intellij idea main java wp the professor. Please make sure to only implement what is...

    use intellij idea main java wp the professor. Please make sure to only implement what is asked for. You may not add any instance variables to any class, though you may create local variables inside of a method to accomplish its task. No other methods should be created other than the ones listed here. Step 1 Develop the following interface: Interface Name: Queue Interface<T> Access Modifier: public Methods Name: isEmpty Access modifier: public Parameters: none Return type: boolean Name: dequeue...

  • Use the following implementation of LinkedListNode to write the Stack4T> classi public class LinkListNodecT>T private T...

    Use the following implementation of LinkedListNode to write the Stack4T> classi public class LinkListNodecT>T private T info; private LinkListNode link; public LinkListNode ( T info) this, info = info; link = null; public T getInfo() return info; public LinkListNode getlink() return link; public void setInfo( T info) this.infoinfo; public void setLink (LinklistNode link) this.link = link; public interface StackInterface <T T top() throws StackUnderflowException; void pop () throws StackUnderflowException; void push (T element);

  • Step 1 Develop the following class: Class Name: CollegeDegree Access Modifier: public Instance variables Name: major...

    Step 1 Develop the following class: Class Name: CollegeDegree Access Modifier: public Instance variables Name: major Access modifier: private Data type: String Name: numberOfCourses Access modifier: private Data type: int Name: courseNameArray Access modifier: private Data type: String [ ] Name: courseCreditArray Access modifier: private Data type: int [ ] Static variables Name: maximumNumberOfCourses Access modifier: private Data type: int Initial Value: 40 Constructor Name: CollegeDegree Access modifier: public Parameters: none (default constructor) Task: sets major to the empty string...

  • use intellij idea main java Step 3 Develop the following class: Class Name: ImprovedQueue<T> Access Modifier:...

    use intellij idea main java Step 3 Develop the following class: Class Name: ImprovedQueue<T> Access Modifier: public Implements: QueueInterface<T> Instance variables Name: front Access modifier: private Data type: Queue Node<T> Constructors: Name: ImprovedQueue Access modifier: public Parameters: none (default constructor) Task: sets the value of front to null Methods Name: isEmpty Access modifier: public Parameters: none Return type: boolean Task: returns true if the front is equal to null; otherwise return false Name: dequeue Access modifier: public Parameters: none Return...

  • Step 1 Develop the following class: Class Name: Bag Access Modifier: public Instance variables Name: name...

    Step 1 Develop the following class: Class Name: Bag Access Modifier: public Instance variables Name: name Access modifier: private Data Type: String Name: currentWeight Access modifier: private Data Type: double Name: maximumWeight Access modifier: private Data Type: double Constructors Name: Bag Access modifier: public Parameters: none (default constructor) Task: sets the value of the instance variable name to the empty string sets the value of the instance variable currentWeight to 0.0 sets the value of the instance variable maximumWeight to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT