Question: lab 4 code: class AddressNode { public String name, cellPhone, email, degree; AddressNode next, previous; public AddressNode ( String name, String cellPhone, String email, String
"lab code:
class AddressNode public String name, cellPhone, email, degree; AddressNode next, previous; public AddressNodeString name, String cellPhone, String email, String degree this.name name; this.cellPhone cellPhone; this.email email; this.degree degree; this.next null; this.previous null; class AddressBook private AddressNode head, tail; public AddressBook head null; tail null; public void addAtHeadString name, String phone, String email, String degree AddressNode newNode new AddressNodename phone, email, degree; ifhead null head tail newNode; else newNode.next head; head.previous newNode; head newNode; public void addAtTailString name, String phone, String email, String degree AddressNode newNode new AddressNodename phone, email, degree; ifhead null head tail newNode; else newNode.previous tail; tail.next newNode; tail newNode; public void removeFromHead ifhead null System.out.printlnEmpty address book!""; return; ifhead tail head tail null; else head head.next; head.previous null; public void removeFromTail ifhead null System.out.printlnEmpty address book!""; return; ifhead tail head tail null; else tail tail.previous; tail.next null; public void displayList AddressNode temp head; ifhead null System.out.printlnEmpty address book!""; return; whiletemp null System.out.printlnName: temp.name Phone: temp.cellPhone Email: temp.email Degree: temp.degree; temp temp.next; Test Class: public class TestAddressBook public static void mainString args AddressBook adBook new AddressBook; adBook.addAtHeadFahadFahad@alfaisal.edu"", MED; adBook.addAtHeadFaisalFaisal@alfaisal.edu"", MED; System.out.printlnAfter adding two nodesFahad & Faisal at the head:""; adBook.displayList; System.out.println; adBook.addAtTailSaudSaud@alfaisal.edu"", SE; adBook.addAtTailAhmedAhmed@alfaisal.edu"", SE; System.out.println
After adding two nodesSaud & Ahmed at the tail:""; adBook.displayList; System.out.println; adBook.removeFromHead; System.out.println
After removing one node from the head:""; adBook.displayList; System.out.println; adBook.removeFromTail; System.out.println
After removing one node from the tail:""; adBook.displayList; System.out.println XR;
Based on the doubly linked list code created during lab Create a doubly linked list based queue that does each of the following: Create an empty queue. Add a String to the queue Print the content of the queue. Repeat steps and three times and observe the output check if your implementation is correct. Paste the screen shot of your program and output here:"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
