1)Write a Java program which stores three values by using singly linked list. - Node class 1. stuID, stuName, stuScore, //data fields 2. constructor 3. update and accessor methods - Singly linked list class which must has following methods: 1. head, tail, size// data fields 2. constructor 3. update and accessor methods a. getSize() //Returns the number of elements in the list. b. isEmpty( ) //Returns true if the list is empty, and false otherwise. c. getFirstStuID( ), getStuName( ), getFirstStuScore( ) d. addFirst(stuID, stuName, stuScore) e. addLast(stuID, stuName, stuScore) f. removeFirst ( ) //Removes and returns the first element of the list. g. displayList( ) //Displays all elements of the list by traversing the linked list. - Test class – initialize a singly linked list instance. Test all methods of singly linked list class.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 18SA
icon
Related questions
icon
Concept explainers
Question
1)Write a Java program which stores three values by using singly linked list.
- Node class
1. stuID, stuName, stuScore, //data fields
2. constructor
3. update and accessor methods
- Singly linked list class which must has following methods:
1. head, tail, size// data fields
2. constructor
3. update and accessor methods
a. getSize() //Returns the number of elements in the list.
b. isEmpty( ) //Returns true if the list is empty, and false otherwise.
c. getFirstStuID( ), getStuName( ), getFirstStuScore( )
d. addFirst(stuID, stuName, stuScore)
e. addLast(stuID, stuName, stuScore)
f. removeFirst ( ) //Removes and returns the first element of the list.
g. displayList( ) //Displays all elements of the list by traversing the linked list.
- Test class – initialize a singly linked list instance. Test all methods of singly linked list class.
 
 
 
2. Write a Java program which stores three values by using doubly linked list.
- Node class
4. stuID, stuName, stuScore, //data fields
5. constructor
6. update and accessor methods
- Singly linked list class which must has following methods:
4. head, tail, size// data fields
5. constructor
6. update and accessor methods
a. getSize() //Returns the number of elements in the list.
b. isEmpty( ) //Returns true if the list is empty, and false otherwise.
c. getFirstStuID( ), getStuName( ), getFirstStuScore( )
d. addFirst (stuID, stuName, stuScore)
e. addLast(stuID, stuName, stuScore)
f. removeFirst( ) //Removes and returns the first element of the list.
g. removeLast( ) //Removes and returns the first element of the list.
h. displayList( ) //Displays all elements of the list by traversing the linked list.
- Test class – initialize a doubly linked list instance. Test all methods of doubly linked list class.
 
 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Types of Linked List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning