Question: Solving it like a beginner programmer not like a Professional programmer, and use the ADT Merging as one of the Data Structure Operations combines data

Solving it like a beginner programmer not like a Professional programmer, and use the ADT
 Solving it like a beginner programmer not like a Professional programmer,
and use the ADT Merging as one of the Data Structure Operations
combines data elements from two data structures into one. Different data structure
types can be merged such as, Linked lists, Stacks as well as
Queues. Using the required ADTs, Write a Java program that:- - Writing
a program that helps to enter patients information: - Write a class
patientInfo which contains the following data and methods: - Data: PatientName (String).
PatientID (int). - Methods: Getter and Setter for each data item. toString
method. - Display this menu: 1: Merging two Single Linked List structure
type 2.Merging two Stacks data structure type 3:Merging two Queses data structure

Merging as one of the Data Structure Operations combines data elements from two data structures into one. Different data structure types can be merged such as, Linked lists, Stacks as well as Queues. Using the required ADTs, Write a Java program that:- - Writing a program that helps to enter patients information: - Write a class patientInfo which contains the following data and methods: - Data: PatientName (String). PatientID (int). - Methods: Getter and Setter for each data item. toString method. - Display this menu: 1: Merging two Single Linked List structure type 2.Merging two Stacks data structure type 3:Merging two Queses data structure type 4:Merging Single Linked List with Stack to Linked List 5:Merging Single Linked List with Queue to Linked List 6:Merging Singly Linked List with Stack only Patient's name that start with S to Queue - Ask the user to choose the data structure type from a given list to be merged. If you choose any of the above options: 1.You must request [the size of data structures and patient information] from the user. 2. Print the data structure before the merge. 3. Print data structure after the merge. Node E newest = new Node E(elem, nul1); if (isEmpty()) \{ front = newest; / / special case of a previously empty queue J else f rear. setNext (newest); I/ add node at the tail of the list ] rear = newest; // update the reference to the tail node return term; 3 system.out.print("The required stack data is: Top...> ") ; 1 public class Node E>1 private E element; // reference to the element stored at this node private Node next; I/ reference to the subsequent node in the 1 ist * Qauthor Shroo */ public class Patient \{ Data private string PatientName; private int PatientID; Const public Patient(string PatientName, int PatientID) \{ this.PatientName=PatientName; this. PatientID=PatientID; 1 1/ Setters public void setPatientName (string PatientName) \{ this. PatientName=PatientName; \} public void setPatientID(int PatientID) \{ this. PatientID=PatientID; \} getters public string getPatientName() \& return this. PatientName; I public int getPatientid() { return this.PatientID; } tostring eoverride public string tostring() l return string. format ("Patient's name : "+this. PatientName+" Patient's ID: "+this. PatientID +" " );} 1 /I update methods public void addFirst(Ee) f// adds element e to the front of the list Node E newest = new Node (e, nul1 );// create and link a new node newest. setNext (head) ; head = newest; if ( size =0) ( tail = head; 1/ special case: new node becomes tail also 3 sizet+; 1 public void addIast (Ee)(// adds element e to the end of the list Node E newest = new Node E(e, nul1); // node wil1 eventually be the tail if (isEmpty ()) ( head = newest; 1/ special case: previously empty 1 ist l else \{ tail. setNext(newest); II new node after existing tail 1 tail = newest; /1 new node becomes the tail size+ti public E removeFirst() f// removes and returns the first element if (isempty()) 1 return null; 1/ nothing to remove ) E answer = head.getelement(); head = head.getNext (); /I wil11 become nul1 if list had only one node size-; if (size=0) tail = nu11; 1/ special case as 1 ist is now empty

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!