From fc4e4da1a0bb88cf04dda8a521801088d10ab1d5 Mon Sep 17 00:00:00 2001 From: Gargee31 <112091775+Gargee31@users.noreply.github.com> Date: Sun, 30 Apr 2023 23:08:51 +0530 Subject: [PATCH] Create Stacksmurfs.java --- Stacksmurfs.java | 280 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 280 insertions(+) create mode 100644 Stacksmurfs.java diff --git a/Stacksmurfs.java b/Stacksmurfs.java new file mode 100644 index 0000000..28151f0 --- /dev/null +++ b/Stacksmurfs.java @@ -0,0 +1,280 @@ +import java.util.*; +class Node{ +String name; +Node next; +Node previous; +String date; + + +Node(String name,String date){ //constructor +next=null; +previous=null; +this.name=name; +this.date=date; +} +} + + +class op{ +Scanner in=new Scanner(System.in); +Stack stac = new Stack<>(); + +void details() { +int op=0; + +do { +System.out.println("Enter the patient's name:"); +String name=in.next(); +System.out.println("Enter the patient's age:"); +int age=in.nextInt(); +System.out.println("Enter the patient's number:"); +String contact=in.next(); +System.out.println("Enter the admitted department:"); +String d=in.next(); +System.out.println("Last admitted date"); +String admit=in.next(); + +stac.push("\nName"+name+"\nAge:"+age+"\nContact"+contact+"\nDept:"+d+"\nLast admitted:"+admit); + +System.out.println("Press 1 if you have completed all the details"); +op=in.nextInt(); + + +} while(op==0); + + +} +void hist() { +Stack st=new Stack<>(); + +if(stac.isEmpty()) { +System.out.println("No patient history yet."); +} +else { +while(!stac.isEmpty()) +{ +String det= stac.pop(); + +System.out.println(det+ " "); +st.push(det); +} +while(!st.isEmpty()) +{ +String det2 = st.pop(); +stac.push(det2); +} +} +} +Node arr[]=new Node[5]; +String str[]=new String[5]; + +op(){ +for(int i=0;i<5;i++) { +arr[i]=null; +} +str[0]="Orthodentistry"; +str[1]="Opthalmology"; +str[2]="Cardiology"; +str[3]="Gynaecology"; +str[4]="Homeopathy"; +} +void enq() { + + + +System.out.println("\n1)Orthodentistry\n2)Opthalmology\n3)Cardiology\n4)Gynaecology\n5)Homeopathy\n"); +System.out.println("Enter your choice:"); +int ch=in.nextInt(); + +if(ch==1) +{ +System.out.println("Enter the number of medicines you wish to add-"); +int num=in.nextInt(); +Node temp=null; +for(int i=0;i