SlideShare a Scribd company logo
package patienttest;
import java.util.Comparator;
import java.util.Date;
public class Patient implements Comparator{
String Name;
Date DOB;
Date Admission;
String Complaint;
int Priority;
public Patient(String name,Date d1,Date ad,String complaint,int p)
{
Name=name;
DOB=d1;
Admission=ad;
Complaint=complaint;
Priority=p;
}
public void setName(String name)
{
Name=name;
}
public void setDOB(Date d1)
{
DOB=d1;
}
public void setAdmission(Date d2)
{
Admission=d2;
}
public void setComplaint(String complaint)
{
Complaint=complaint;
}
public void setPriority(int p)
{
Priority=p;
}
public String setName()
{
return Name;
}
public Date setDOB()
{
return DOB;
}
public Date setAdmission()
{
return Admission;
}
public String setComplaint()
{
return Complaint;
}
public int setPriority()
{
return Priority;
}
@Override
public String toString()
{
String msg="";
msg+="Name: "+Name;
msg+="DOB: "+DOB;
msg+="Admission: "+Admission;
msg+="Complaint: "+Complaint;
msg+="Priority: "+Priority;
return msg;
}
@Override
public int compare(Patient p1, Patient p2) {
int value=1;
if(p1.Priority>p2.Priority)
value=1;
else if(p1.Priority0)
value=1;
else
value=-1;
}
return value;
}
}
Solution
package patienttest;
import java.util.Comparator;
import java.util.Date;
public class Patient implements Comparator{
String Name;
Date DOB;
Date Admission;
String Complaint;
int Priority;
public Patient(String name,Date d1,Date ad,String complaint,int p)
{
Name=name;
DOB=d1;
Admission=ad;
Complaint=complaint;
Priority=p;
}
public void setName(String name)
{
Name=name;
}
public void setDOB(Date d1)
{
DOB=d1;
}
public void setAdmission(Date d2)
{
Admission=d2;
}
public void setComplaint(String complaint)
{
Complaint=complaint;
}
public void setPriority(int p)
{
Priority=p;
}
public String setName()
{
return Name;
}
public Date setDOB()
{
return DOB;
}
public Date setAdmission()
{
return Admission;
}
public String setComplaint()
{
return Complaint;
}
public int setPriority()
{
return Priority;
}
@Override
public String toString()
{
String msg="";
msg+="Name: "+Name;
msg+="DOB: "+DOB;
msg+="Admission: "+Admission;
msg+="Complaint: "+Complaint;
msg+="Priority: "+Priority;
return msg;
}
@Override
public int compare(Patient p1, Patient p2) {
int value=1;
if(p1.Priority>p2.Priority)
value=1;
else if(p1.Priority0)
value=1;
else
value=-1;
}
return value;
}
}

More Related Content

PDF
Here is how the code works1. Patient.java is an Abstract Class whi.pdf
PPTX
Code Smells y Refactoring o haciendo que nuestro codigo huela (y se vea) mejo...
PDF
i need help to edit the two methods below so that i can have them wo.pdf
PPTX
Refactoring - Mejorando el diseño del código existente
PDF
Creating a Facebook Clone - Part XX.pdf
PDF
Hello. Im creating a class called Bill. I need to design the class.pdf
DOCX
Java Code for Sample Projects Inheritance
PDF
public class Person { private String name; private int age;.pdf
Here is how the code works1. Patient.java is an Abstract Class whi.pdf
Code Smells y Refactoring o haciendo que nuestro codigo huela (y se vea) mejo...
i need help to edit the two methods below so that i can have them wo.pdf
Refactoring - Mejorando el diseño del código existente
Creating a Facebook Clone - Part XX.pdf
Hello. Im creating a class called Bill. I need to design the class.pdf
Java Code for Sample Projects Inheritance
public class Person { private String name; private int age;.pdf

Similar to package patienttest;import java.util.Comparator; import java..pdf (9)

PDF
Project .javaimport java.util.;public class Project impleme.pdf
PDF
import java.util.Arrays;import java.util.List;public class Bursa.pdf
PDF
can do this in java please thanks in advance The code that y.pdf
PDF
Patient.java package A9.toStudents; public class Patient imple.pdf
PDF
BasicPizza.javapublic class BasicPizza { String type; String c.pdf
PDF
Here is the codeimport java.util.; class GroceryItem { Stri.pdf
PDF
public class Patient extends Person {=========== Properties ====.pdf
PDF
Having a problem figuring out where my errors are- The code is not run.pdf
Project .javaimport java.util.;public class Project impleme.pdf
import java.util.Arrays;import java.util.List;public class Bursa.pdf
can do this in java please thanks in advance The code that y.pdf
Patient.java package A9.toStudents; public class Patient imple.pdf
BasicPizza.javapublic class BasicPizza { String type; String c.pdf
Here is the codeimport java.util.; class GroceryItem { Stri.pdf
public class Patient extends Person {=========== Properties ====.pdf
Having a problem figuring out where my errors are- The code is not run.pdf

More from annucommunication1 (20)

PDF
4r = 2 L2r = L2thats none of the above, since you didnt wrote t.pdf
PDF
41.Ans. Ans,Sarcoplasmic reticulumSarcoplasmic reticulum is a type.pdf
PDF
1.c. developers2.e. A and B3.c. Land and Built space4. Money a.pdf
PDF
ZnO + H2O = Zn(OH)2 .pdf
PDF
will result in the formation of a soluble complex.pdf
PDF
What types of elements are involved in metallic b.pdf
PDF
The correct statements are When two atoms of app.pdf
PDF
Sure can There you go. .pdf
PDF
One P2O5 contains five oxygen 3.45 x 5 = 17.3 mol.pdf
PDF
Na2O is basic NO2 is acidic SO2 is acidic CO2 is .pdf
PDF
moles of CO2 = moles of NaHCO3 = 284 =0.0238 .pdf
PDF
Eukaryotic Chromosome Structure The length of DN.pdf
PDF
Fe + S ---- FeS moles of Fe = 9.4256 = 0.1682 m.pdf
PDF
D. is correct. Solution .pdf
PDF
The various ways to finance a project are 1)Debt financing-One ca.pdf
PDF
boiling point 1-propanol propanone note there.pdf
PDF
The organs of urinary system includesPaired kidneys, paired ureter.pdf
PDF
The incorrect statement ise. Glucose is a stereoisomer of ribose..pdf
PDF
The answer is a. The intermolecular forces are much greater in wate.pdf
PDF
potassium and sulfur - K2S Ionic Bondcalcium and chlorine - CaCl2 .pdf
4r = 2 L2r = L2thats none of the above, since you didnt wrote t.pdf
41.Ans. Ans,Sarcoplasmic reticulumSarcoplasmic reticulum is a type.pdf
1.c. developers2.e. A and B3.c. Land and Built space4. Money a.pdf
ZnO + H2O = Zn(OH)2 .pdf
will result in the formation of a soluble complex.pdf
What types of elements are involved in metallic b.pdf
The correct statements are When two atoms of app.pdf
Sure can There you go. .pdf
One P2O5 contains five oxygen 3.45 x 5 = 17.3 mol.pdf
Na2O is basic NO2 is acidic SO2 is acidic CO2 is .pdf
moles of CO2 = moles of NaHCO3 = 284 =0.0238 .pdf
Eukaryotic Chromosome Structure The length of DN.pdf
Fe + S ---- FeS moles of Fe = 9.4256 = 0.1682 m.pdf
D. is correct. Solution .pdf
The various ways to finance a project are 1)Debt financing-One ca.pdf
boiling point 1-propanol propanone note there.pdf
The organs of urinary system includesPaired kidneys, paired ureter.pdf
The incorrect statement ise. Glucose is a stereoisomer of ribose..pdf
The answer is a. The intermolecular forces are much greater in wate.pdf
potassium and sulfur - K2S Ionic Bondcalcium and chlorine - CaCl2 .pdf

Recently uploaded (20)

PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Cell Structure & Organelles in detailed.
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Pharma ospi slides which help in ospi learning
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
master seminar digital applications in india
PDF
Computing-Curriculum for Schools in Ghana
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
O5-L3 Freight Transport Ops (International) V1.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Cell Structure & Organelles in detailed.
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Anesthesia in Laparoscopic Surgery in India
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Pharma ospi slides which help in ospi learning
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Final Presentation General Medicine 03-08-2024.pptx
202450812 BayCHI UCSC-SV 20250812 v17.pptx
master seminar digital applications in india
Computing-Curriculum for Schools in Ghana
STATICS OF THE RIGID BODIES Hibbelers.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf

package patienttest;import java.util.Comparator; import java..pdf

  • 1. package patienttest; import java.util.Comparator; import java.util.Date; public class Patient implements Comparator{ String Name; Date DOB; Date Admission; String Complaint; int Priority; public Patient(String name,Date d1,Date ad,String complaint,int p) { Name=name; DOB=d1; Admission=ad; Complaint=complaint; Priority=p; } public void setName(String name) { Name=name; } public void setDOB(Date d1) { DOB=d1; } public void setAdmission(Date d2) { Admission=d2; } public void setComplaint(String complaint) { Complaint=complaint; } public void setPriority(int p)
  • 2. { Priority=p; } public String setName() { return Name; } public Date setDOB() { return DOB; } public Date setAdmission() { return Admission; } public String setComplaint() { return Complaint; } public int setPriority() { return Priority; } @Override public String toString() { String msg=""; msg+="Name: "+Name; msg+="DOB: "+DOB; msg+="Admission: "+Admission; msg+="Complaint: "+Complaint; msg+="Priority: "+Priority; return msg; } @Override public int compare(Patient p1, Patient p2) {
  • 3. int value=1; if(p1.Priority>p2.Priority) value=1; else if(p1.Priority0) value=1; else value=-1; } return value; } } Solution package patienttest; import java.util.Comparator; import java.util.Date; public class Patient implements Comparator{ String Name; Date DOB; Date Admission; String Complaint; int Priority; public Patient(String name,Date d1,Date ad,String complaint,int p) { Name=name; DOB=d1; Admission=ad; Complaint=complaint; Priority=p; } public void setName(String name) { Name=name; }
  • 4. public void setDOB(Date d1) { DOB=d1; } public void setAdmission(Date d2) { Admission=d2; } public void setComplaint(String complaint) { Complaint=complaint; } public void setPriority(int p) { Priority=p; } public String setName() { return Name; } public Date setDOB() { return DOB; } public Date setAdmission() { return Admission; } public String setComplaint() { return Complaint; } public int setPriority() { return Priority; }
  • 5. @Override public String toString() { String msg=""; msg+="Name: "+Name; msg+="DOB: "+DOB; msg+="Admission: "+Admission; msg+="Complaint: "+Complaint; msg+="Priority: "+Priority; return msg; } @Override public int compare(Patient p1, Patient p2) { int value=1; if(p1.Priority>p2.Priority) value=1; else if(p1.Priority0) value=1; else value=-1; } return value; } }