Need help with this java assingnment UML DIAGRAM FOR AND DIS

Need help with this java assingnment.

UML DIAGRAM FOR AND DISCUSSION FOR ListNode

ListNode<E extends Comparable<E>>

data : E

nextNode: ListNode<E>

<<constructor>>ListNode(d : E)

<<constructor>>ListNode(d : E, node : ListNode<E>)

+ setData(d : E)

+getData() : E

+setNext(next : ListNode<E>)

+getNext() : ListNode<E>

Notes on ListNode

ListNode(d : E) sets the nextNode to null, the rest of the implementation of the ListNode class is self-explanatory as discussed in class

ListNode<E extends Comparable<E>>

data : E

nextNode: ListNode<E>

<<constructor>>ListNode(d : E)

<<constructor>>ListNode(d : E, node : ListNode<E>)

+ setData(d : E)

+getData() : E

+setNext(next : ListNode<E>)

+getNext() : ListNode<E>

Solution

import java.util.Scanner;

/* Class Node */
class ListNode
{
protected int data;
protected ListNode link;

/* Constructor */
public ListNode()
{
link = null;
data = 0;
}
/* Constructor */
public ListNode(int d,ListNode n)
{
data = d;
link = n;
}
/* Function to set link to next Node */
public void setNext(ListNode n)
{
link = n;
}
/* Function to set data to current Node */
public void setData(int d)
{
data = d;
}
/* Function to get link to next node */
public ListNode getNext()
{
return link;
}
/* Function to get data from current Node */
public int getData()
{
return data;
}
public static void main(String[] args) {
       // TODO Auto-generated method stub
  

}

  

}

Need help with this java assingnment. UML DIAGRAM FOR AND DISCUSSION FOR ListNode ListNode<E extends Comparable<E>> data : E nextNode: ListNode<E
Need help with this java assingnment. UML DIAGRAM FOR AND DISCUSSION FOR ListNode ListNode<E extends Comparable<E>> data : E nextNode: ListNode<E

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site