Question: Part I: Implement a Single linked list to store student information ( stuID , stuName, stuScore ) . Instance variables Constructor Accessor and Update methods

Part I:
Implement a Single linked list to store student information (stuID, stuName, stuScore).
Instance variables
Constructor
Accessor and Update methods
1. Define a Node Class.
a. Instance Variables
o A stuID -(generics framework)
o B stuName -(generics framework)
o C stuScore -(generics framework)
o Node Next (pointer)- refer to the next node (Self-referential)
b. Constructor
c. Methods
o A getStuID()//Return the stuID of this node.
o setStuID ()//set the StuID of this node.
o A getStuName()//Return the stuName of this node.
o setStuName()//Return the stuName of this node.
o A getStuScore()//Return the stuScore of this node.
o setStuScore()//Return the stuScore of this node.
o Node getNext()//Return the pointer of this node.
o setNext(n)//Set pointer to this node.
o displayNode()//Display information of this node.
2. Define SLinkedList Class
a. Instance Variables:
o Node head
o Node tail
o int size
b. Constructor
c. Methods
o int getSize()//Return the number of nodes of the list.
o boolean isEmpty()//Return true if the list is empty, and false otherwise.
o int getFirstStuID()//Return the StuID of first node of the list.
o int getLastStuID()//Return the StuID of Last node of the list.
o int getFirstStuName()//Return the StuName of first node of the list.
o int getLastStuName()//Return the StuName of Last node of the list.
o int getFirstStuScore()//Return the StuScore of first node of the list.
o int getLastStuScor ()//Return the StuScore of Last node of the list.
o Node getHead()//Return the head
o setHead(Node h)//Set the head
o Node getTail()//Return the tail
o setTail(Node t)//Set the tail
o addFirst(A id, B name, C score)//add new id, name, score to the front
of the list
o addLast(A id, B name, C score)// add new id, name, score to the end of
the list
o E removeFirst()//Remove the first node and return the id of the first node
of list
o display()//print out values of all the nodes of the list
o Node search(A id)//check if a given id is in the list, return found nodes
or null
o Node update(A key, A id, B name, C score)//update the id, name, score
of node with a given k to new value, return updated node
3. Define TestSLinkedList Class
a. Declare an instance of Single List class.
b. Test all the methods of Single List class.
search(e)// Return one node with 3 values (stuID, stuName, stuScore) which matches a
given key e (studentID).
addAfter(e, stuID, stuName, stuScore)//Add a new node with 3 values (stuID, stuName,
stuScore) after the node with the key e (studentID).
removeAt(e)//Remove a node which matches a given key e (studentID)
count()//Return a number of nodes of list.
update(stuID, stuName, stuScore)//Update the values of one node

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!