Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 Selfreferential
b Constructor
c Methods
o A getStuIDReturn the stuID of this node.
o setStuID set the StuID of this node.
o A getStuNameReturn the stuName of this node.
o setStuNameReturn the stuName of this node.
o A getStuScoreReturn the stuScore of this node.
o setStuScoreReturn the stuScore of this node.
o Node getNextReturn the pointer of this node.
o setNextnSet pointer to this node.
o displayNodeDisplay information of this node.
Define SLinkedList Class
a Instance Variables:
o Node head
o Node tail
o int size
b Constructor
c Methods
o int getSizeReturn the number of nodes of the list.
o boolean isEmptyReturn true if the list is empty, and false otherwise.
o int getFirstStuIDReturn the StuID of first node of the list.
o int getLastStuIDReturn the StuID of Last node of the list.
o int getFirstStuNameReturn the StuName of first node of the list.
o int getLastStuNameReturn the StuName of Last node of the list.
o int getFirstStuScoreReturn the StuScore of first node of the list.
o int getLastStuScor Return the StuScore of Last node of the list.
o Node getHeadReturn the head
o setHeadNode hSet the head
o Node getTailReturn the tail
o setTailNode tSet the tail
o addFirstA id B name, C scoreadd new id name, score to the front
of the list
o addLastA id B name, C score add new id name, score to the end of
the list
o E removeFirstRemove the first node and return the id of the first node
of list
o displayprint out values of all the nodes of the list
o Node searchA idcheck if a given id is in the list, return found nodes
or null
o Node updateA key, A id B name, C scoreupdate the id name, score
of node with a given k to new value, return updated node
Define TestSLinkedList Class
a Declare an instance of Single List class.
b Test all the methods of Single List class.
searche Return one node with values stuID stuName, stuScore which matches a
given key e studentID
addAftere stuID, stuName, stuScoreAdd a new node with values stuID stuName,
stuScore after the node with the key e studentID
removeAteRemove a node which matches a given key e studentID
countReturn a number of nodes of list.
updatestuID stuName, stuScoreUpdate the values of one node
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started