this is an example of a code just need help to correct it and make it as the lab want
Lab 5: Circular Double Linked-List Objective(s) 1- Create Circular Double Linked-List in Java. 2- Deal with Circular Double Linked-List in case of: insertion, Deletion, searching Tool(s)/Software Java programming language with NetBeans IDE. Description: The Double Linked List has the same Node structure but every Node has 2 pointers for the next and previous Node. The Double Linked List with Head. Prev = null and Tail.next = null are called: Double Linked-List. Head Nulk Null The Double Linked List with Head.Prev = tail and Tail next = head are called: Circular Double Linked-List. head Tall 1 A. How to Create Circular Double Linked-List in Java: There are 3-steps approach to create Circular Double Linked-List in Java Step 1: Declare class for the Node - forming the structure of the node. private class Mode private int course; private String courseName: private Node next; private Node provi public Node (int courseID, String courseName, Node next, Node prev) 1.6 lines) public int getCourseID () .lines public string getCourseName() (lines public Node getNext()...3 lines public Node getPrev... public void setCourseID (int courseID) ... lines public void setCourseName (String courseName) 3 line 1 public void setNext (Node next) L... lines public void set Prev (Node prev) ...3 linea Step 2: Declare the Circular Double LinkedList class that includes the Node class. public class CircularDoublelinkedlist private class Node 2011 Node head nulli Node tal null: int si public CircularDoublelinkediato con los public int fir ID). public int lastID) publie int getice () nes public boolean isimpty() Ines publie vold forwardTraversing ... 12 linan public void backwardTraversing).12. lines public void addFirst(int id, string Nane) ... 15 lines public void addLantint id, string nane) linus public vold findint ld) ... 23 linos public void insertat Postint id, string nano, int pos) .22 Linea public vold deletoFirst) .12 Linea public void deleteLast) ...2 lines i public void delete.Node(int id) ...30 Lines Step 3: Define the object of Circular DoubleLinkedList class: CircularDoublelinkedList l-new CircularDoubleLinkedLis(); 1.addFirst (3, "CS310"); 1.addFirst (2,"CS321"); B. Circular Double Linked-List Operations: 1. Traversing Circular Double Linked-List (Forward, Backward). 2. Searching in Circular Double Linked-List 3. Insertion in Circular Double Linked-List (addFirst, addLast, addAtPos) 4. Deletion from Circular Double Linked-List (deleteFirst, deleteLast. deleteNode) Tasks/Assignments(s) 1. Create Circular DoublelinkedList class. Each node should have course ID and name in the data section. Apply all the following operations: Display: forward Display, backward Display. Adition: addFirst, addLast, addAtPos. Deletion: deleteFirst, deleteLast, delete Node. FindNode: to find a node with specific given ID. 2. Add find Duplicate method to Circular DoubleLinkedList class to find and display courses with DUPLICATE IDs. Sample output after adding some nodes to the list and calling find Duplicate method: 19-333 - Tame Islamie ID: 512 - Hamatha ID: 61 - Name: Digital Hardware ID: 512 - Name: Data Struere ID:44 - Same :0002 ID:707 - 0022 ID: 131 - Name:OOP ID:333-Hameathi ID:444 - Home: thyeles Duplicate ID: 333 Tor Course Pianie Maths Duplicate ID: 512 Tor Courses: Metha. Data Stutures Duplicate ID: 144 Foz Courses: 2012. Physics BUILD SUCCESSFUL total cimer seconda Deliverables(s) You are required to implement and deliver a Java program as described in the previous section CS 310: Data Structure Page 3 To change this license header, choose License Headers in Project Properties To change this template file, choose Tools Templates and open the template in the editor 1 package labs **/ author Fatema ce public class Circular Doublelinkedlist }private class Node private int courseID private String courseName private Node next private Node prev }public Node(int courselD, String courseName, Node next, Node prev) this courselD-courseID this.courseName = courseName this. next next this.prev=prev Opublic int getCoursel ;return coursel { public String getCourseName return courseName public Node getNext return next public Node getPrev return prev public void setCourse Dint courseID) this courselD = courseID { public void setCourseName(String courseName) this.courseName = courseName public void setNext(Node next) this next next Jpublic void setPrev Node prev) this.prev=prev Node head = null Node tail = null int size Opublic CircularDoublelinkedList public void addFirst(int id, String name) Node newNode = new Nodeid, name, null, null) Hif (head == null) head=newNode tail = head inewNode.next-head new Node prev=head Jelse new Node next = head chead prev= newNode newNode.prevatail tail next = newNode thead=newNode { + size public void addlast(int id, String name) Node newNode = new Nodeid, name,null, null) }if(head == null) head = newNode tail = head newNode.next-head newNode.prevhead Jelse newNode.prevtail tail.next = newNode newNode.next=head head.prev = newNode tailenewNode ++size public void addAtposfint id, String name int pos) Node newNode = new Node(id,name, null, nuli) Node current - head int counter = 1 Node temp = current.next if (pos -- 1) addFirst(id, name) } else Opublic void forwardDisplay Node current = head }if(head == null) :System.out.println("The list is empty") return { ) do System.out.println("ID: " + current.getCourselD0) + " - Name:" + current.getCourseName()) current current.next (while(current l= head { public void backwardDisplay Node current = head ifhead == null) System.out.println("The list is empty") return { } do System.out.println("ID: "* current.getCourseID() + "- Name:" + current.getCourseName()) current current.prev (while(current l-head { Opublic void deleteFisrt if (size -- 0) System.out.println("The list is empty") return { head head. next head.prev=tail tail.next = head ---size }if(size 0) head=null tail=null } public void delete Node(int id) Jif (sizeo) System.out.println("The list is empty") return Node current = head Node previous head Jwhile (current.courselD != id) }if(current.next == head) System.out.println("Can't find value") return { }else previous = current current current.next { { previous.next current.next current current.next current.prev= previous :-size { Opublic void deletelast }if (size == 0) System.out.println("The list is empty") return { tail = tail.prev head.prev= tail tail.next whead -size if (size 0) head=null tail=null { } public void findNodeint id) Hif (size == 0) System.out.println("The list is empty") return Node current = head inn 1 ) do yif (current courseID -- id) System.out.println("Course found at node:" + n) return ( current current.next ++n :(while(current is head System.out.println("Sorry could not find a matching course id") { public void find Duplicate } if (size == 0) System.out.printin("The list is empty") return { Node current = head Node current2 = head int d0 }do current2 = current.next while(current2 l=head) }if(current.courseID == current2.coursel) System.out.println("Duplicate ID:" + current.courseID + "For course:" + current.courseName +","current2.courseName) current2 = current2.next ( current = current.next (while(currentlhead Hif (d=0) System.out.println("There are no duplicate") { { The main / To change this license header, choose License Headers in Project Properties To change this template file, choose Tools | Templates and open the template in the editor 1 package labs author Fatema@ } public class Labs ** param args the command line arguments@* 1 } public static void main(Strinel] args) CircularDoublelinked List = new Circular Doublelinked List c.addFirst(333, "CIS") c.addFirst(342, "CS") caddFirst(123, "HIST") c.addlast(342, "ARAB") :()c.forward Display c.addAtPos(909, "Hala",3) ()c backwardDisplay (c.findDuplicate { {