Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public class HeadTailList { private class Node { double item; Node next; } private Node head; private Node tail; private int size; public HeadTailList (

public class HeadTailList{
private class Node {
double item;
Node next;
}
private Node head;
private Node tail;
private int size;
public HeadTailList(){
head = null;
tail = null;
size =0;
}
public HeadTailList(double value)
{
// Constructor implementation needed
}
public boolean isEmpty(){
return size ==0;
}
public int length(){
return size;
}
// Additional methods to be implemented...
}public class HeadTailList{
private class Node {
double item;
Node next;
}
private Node head;
private Node tail;
private int size;
public HeadTailList(){
head = null;
tail = null;
size =0;
}
public HeadTailList(double value)
{
// Constructor implementation needed
}
public boolean isEmpty(){
return size ==0;
}
public int length(){
return size;
}
// Additional methods to be implemented...
}a)(10 points) Implement the HeadTailList (double value) constructor.Testing your implementation
Please complete the above implementation and keep it as a file HeadTailList. java.
Please write a main method in another file to perform the following steps to test your
implementation.
(10 points) Read from the text file "double_values.txt" to insert these values
into the head of the list and display all the elements of the list.
(5 points) Insert the value 59.5 at the end of the list.
(5 points) Insert the value 188.5 at the position of index 2.
(5 points) Delete the last element of the list.
(5 points) Display all the elements of the list.jnl
b)(10 points) Implement a method insertFront (double value) to add a new element at
the front of the list.
c)(10 points) Implement a method insertEnd (double value) to add a new element at the
end of the list.
d)(20 points) Implement a method insertAtPosition(double value, int position) to
insert a new element at a specified position in the list.
e)(10 points) Implement a method removeEnd() to delete the last element of the list.
f)(10 points) Implement a method printList () to display all items in the list.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions