SlideShare a Scribd company logo
1 of 4
Download to read offline
public class Patient extends Person {
//=========== Properties ===============
private int pId;
private String address;
//=========== Constructors =============
public Patient(){
super();//set 4 properties to blank
pId = 0;
address = "";
}
public Patient(int p,String f,String l,String e, int pi,String a){
super(p,f,l,e);//pass 4 properties to super class
pId = pi;
address = a;
}
//=========== Behavior =================
public void setPId( int pi){pId = pi;}
public int getPId(){
return pId;}
public void setAddress(String a){address = a;}
public String getAddress(){
return address;}
public void display(){
super.display();//calls display in the super class to display 4 properties
System.out.println("Patient Id = A"+getPId());
System.out.println("Address = "+getAddress());
}//end display()
public static void main(String args[]){
//Object 1
Patient pa1;
pa1 = new Patient();//calls no arg constructor
pa1.setPId(900);
pa1.setAddress("Marietta");
pa1.display();
System.out.println(" ");//space between to objects
//Object 2
Patient pa2;
pa2 = new Patient(1234,"Jimmy","Hawkins","jhawkins@yahoo.com",901,"Acworth");
//calls multi argument constructor
pa2.display();
}//end main
}//end class
Let’s make it so that we can look up and find a Patient in the “Patients.txt” file. The Patients are
organized by Patients Code. So we should be able to look in the File for Patient “A900”, and it
should give us back all the data about that Patient, like, Patinet Id, etc. So we will need to read
from the “Patients.txt” file and select the Patient Id “A900”. The File is delimited by “:”(colons).
Take a look at the file. use FileInputStream and Buffered reader to read from the file.
Code for testing ‘Select’ that goes in main:
Patient p1 = new Patient();
p1.select(“A900”);
p1.display();
Let’s also make it so that we can add a new Patient to the “Patients.txt” file.use PrintStream and
Buffered writer to write to the file. We should be able to append a new line to the “Patients.txt”
file with all the data for a new Patient, like PatientId,etc.
Code for testing ‘Insert’ that goes in main:
Patient p1 = new Patient();
p1.insert(“A900","1234","Jimmy:Hawkins","Marietta","jhawk@yahoo.com","Cigna");
//now go look in file to see if new line was added
Solution
import java.util.*;
public class Patient
{
private int patientId;
private String patientName;
private String patientAddress;
private String patientPhone;
private Date patientDOB;
public Patient(int patientId, String patientName, String patientAddress, String patientPhone,
Date patientDOB)
{
// initialise instance variables
this.patientId = patientId;
this.patientName = patientName;
this.patientAddress = patientAddress;
this.patientPhone = patientPhone;
this.patientDOB = patientDOB;
}
public void setId (int patientId) {
this.patientId = patientId;
}
public void setName (String patientName){
this.patientName = patientName;
}
public void setAddress (String patientAddress){
this.patientAddress = patientAddress;
}
public void setPhone (String patientPhone){
this.patientPhone = patientPhone;
}
public void setDOB (Date patientDOB){
this.patientDOB = patientDOB;
}
public int getId () {
return patientId;
}
public String getName () {
return patientName;
}
public String getAddress () {
return patientAddress;
}
public String getPhone () {
return patientPhone;
}
public Date getDOB () {
return patientDOB;
}
}
}

More Related Content

Similar to public class Patient extends Person {=========== Properties ====.pdf

Refactoring - Mejorando el diseño del código existente
Refactoring - Mejorando el diseño del código existenteRefactoring - Mejorando el diseño del código existente
Refactoring - Mejorando el diseño del código existenteMariano Sánchez
 
#include iostream #include cstring #include vector #i.pdf
 #include iostream #include cstring #include vector #i.pdf #include iostream #include cstring #include vector #i.pdf
#include iostream #include cstring #include vector #i.pdfanandatalapatra
 
This is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdfThis is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdffeetshoemart
 
Adapt your code from Assignment 2 to use both a Java API ArrayList a.pdf
Adapt your code from Assignment 2 to use both a Java API ArrayList a.pdfAdapt your code from Assignment 2 to use both a Java API ArrayList a.pdf
Adapt your code from Assignment 2 to use both a Java API ArrayList a.pdfalbarefqc
 
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDBTDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDBtdc-globalcode
 
can do this in java please thanks in advance The code that y.pdf
can do this in java please thanks in advance The code that y.pdfcan do this in java please thanks in advance The code that y.pdf
can do this in java please thanks in advance The code that y.pdfakshpatil4
 
Hello. Im creating a class called Bill. I need to design the class.pdf
Hello. Im creating a class called Bill. I need to design the class.pdfHello. Im creating a class called Bill. I need to design the class.pdf
Hello. Im creating a class called Bill. I need to design the class.pdfbarristeressaseren71
 
Table.java Huffman code frequency tableimport java.io.;im.docx
 Table.java Huffman code frequency tableimport java.io.;im.docx Table.java Huffman code frequency tableimport java.io.;im.docx
Table.java Huffman code frequency tableimport java.io.;im.docxMARRY7
 
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docxINTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docxnormanibarber20063
 
BasicPizza.javapublic class BasicPizza { Declaring instance .pdf
BasicPizza.javapublic class BasicPizza { Declaring instance .pdfBasicPizza.javapublic class BasicPizza { Declaring instance .pdf
BasicPizza.javapublic class BasicPizza { Declaring instance .pdfankitmobileshop235
 
i need help to edit the two methods below so that i can have them wo.pdf
i need help to edit the two methods below so that i can have them wo.pdfi need help to edit the two methods below so that i can have them wo.pdf
i need help to edit the two methods below so that i can have them wo.pdfirshadoptical
 
C++ ProgrammingSo I received help with a code that takes a diabet.pdf
C++ ProgrammingSo I received help with a code that takes a diabet.pdfC++ ProgrammingSo I received help with a code that takes a diabet.pdf
C++ ProgrammingSo I received help with a code that takes a diabet.pdffathimafancy
 
@author public class Person{   String sname, .pdf
  @author   public class Person{   String sname, .pdf  @author   public class Person{   String sname, .pdf
@author public class Person{   String sname, .pdfaplolomedicalstoremr
 
why will it not display all of the entries-- output -nMenu n-Add Entr.pdf
why will it not display all of the entries--  output -nMenu n-Add Entr.pdfwhy will it not display all of the entries--  output -nMenu n-Add Entr.pdf
why will it not display all of the entries-- output -nMenu n-Add Entr.pdfabc2232
 
Below is my program, I just have some issues when I want to check ou.pdf
Below is my program, I just have some issues when I want to check ou.pdfBelow is my program, I just have some issues when I want to check ou.pdf
Below is my program, I just have some issues when I want to check ou.pdfdhavalbl38
 
Inheritance compiler support
Inheritance compiler supportInheritance compiler support
Inheritance compiler supportSyed Zaid Irshad
 
Objective Min-heap queue with customized comparatorHospital emerg.pdf
Objective Min-heap queue with customized comparatorHospital emerg.pdfObjective Min-heap queue with customized comparatorHospital emerg.pdf
Objective Min-heap queue with customized comparatorHospital emerg.pdfezhilvizhiyan
 
Having a problem figuring out where my errors are- The code is not run.pdf
Having a problem figuring out where my errors are- The code is not run.pdfHaving a problem figuring out where my errors are- The code is not run.pdf
Having a problem figuring out where my errors are- The code is not run.pdfNicholasflqStewartl
 

Similar to public class Patient extends Person {=========== Properties ====.pdf (20)

Refactoring - Mejorando el diseño del código existente
Refactoring - Mejorando el diseño del código existenteRefactoring - Mejorando el diseño del código existente
Refactoring - Mejorando el diseño del código existente
 
#include iostream #include cstring #include vector #i.pdf
 #include iostream #include cstring #include vector #i.pdf #include iostream #include cstring #include vector #i.pdf
#include iostream #include cstring #include vector #i.pdf
 
This is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdfThis is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdf
 
Adapt your code from Assignment 2 to use both a Java API ArrayList a.pdf
Adapt your code from Assignment 2 to use both a Java API ArrayList a.pdfAdapt your code from Assignment 2 to use both a Java API ArrayList a.pdf
Adapt your code from Assignment 2 to use both a Java API ArrayList a.pdf
 
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDBTDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
 
can do this in java please thanks in advance The code that y.pdf
can do this in java please thanks in advance The code that y.pdfcan do this in java please thanks in advance The code that y.pdf
can do this in java please thanks in advance The code that y.pdf
 
Hello. Im creating a class called Bill. I need to design the class.pdf
Hello. Im creating a class called Bill. I need to design the class.pdfHello. Im creating a class called Bill. I need to design the class.pdf
Hello. Im creating a class called Bill. I need to design the class.pdf
 
Table.java Huffman code frequency tableimport java.io.;im.docx
 Table.java Huffman code frequency tableimport java.io.;im.docx Table.java Huffman code frequency tableimport java.io.;im.docx
Table.java Huffman code frequency tableimport java.io.;im.docx
 
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docxINTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
 
Java2
Java2Java2
Java2
 
BasicPizza.javapublic class BasicPizza { Declaring instance .pdf
BasicPizza.javapublic class BasicPizza { Declaring instance .pdfBasicPizza.javapublic class BasicPizza { Declaring instance .pdf
BasicPizza.javapublic class BasicPizza { Declaring instance .pdf
 
i need help to edit the two methods below so that i can have them wo.pdf
i need help to edit the two methods below so that i can have them wo.pdfi need help to edit the two methods below so that i can have them wo.pdf
i need help to edit the two methods below so that i can have them wo.pdf
 
C++ ProgrammingSo I received help with a code that takes a diabet.pdf
C++ ProgrammingSo I received help with a code that takes a diabet.pdfC++ ProgrammingSo I received help with a code that takes a diabet.pdf
C++ ProgrammingSo I received help with a code that takes a diabet.pdf
 
@author public class Person{   String sname, .pdf
  @author   public class Person{   String sname, .pdf  @author   public class Person{   String sname, .pdf
@author public class Person{   String sname, .pdf
 
why will it not display all of the entries-- output -nMenu n-Add Entr.pdf
why will it not display all of the entries--  output -nMenu n-Add Entr.pdfwhy will it not display all of the entries--  output -nMenu n-Add Entr.pdf
why will it not display all of the entries-- output -nMenu n-Add Entr.pdf
 
Below is my program, I just have some issues when I want to check ou.pdf
Below is my program, I just have some issues when I want to check ou.pdfBelow is my program, I just have some issues when I want to check ou.pdf
Below is my program, I just have some issues when I want to check ou.pdf
 
Inheritance compiler support
Inheritance compiler supportInheritance compiler support
Inheritance compiler support
 
Objective Min-heap queue with customized comparatorHospital emerg.pdf
Objective Min-heap queue with customized comparatorHospital emerg.pdfObjective Min-heap queue with customized comparatorHospital emerg.pdf
Objective Min-heap queue with customized comparatorHospital emerg.pdf
 
Oop lecture9 11
Oop lecture9 11Oop lecture9 11
Oop lecture9 11
 
Having a problem figuring out where my errors are- The code is not run.pdf
Having a problem figuring out where my errors are- The code is not run.pdfHaving a problem figuring out where my errors are- The code is not run.pdf
Having a problem figuring out where my errors are- The code is not run.pdf
 

More from arishmarketing21

A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdfA series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdfarishmarketing21
 
What is the dangling pointer Explain with a proper example.Solut.pdf
What is the dangling pointer Explain with a proper example.Solut.pdfWhat is the dangling pointer Explain with a proper example.Solut.pdf
What is the dangling pointer Explain with a proper example.Solut.pdfarishmarketing21
 
Write a function in javascript that calculates the average element i.pdf
Write a function in javascript that calculates the average element i.pdfWrite a function in javascript that calculates the average element i.pdf
Write a function in javascript that calculates the average element i.pdfarishmarketing21
 
Which a not a likely location of a bacterial to be found Atheroscle.pdf
Which a not a likely location of a bacterial to be found  Atheroscle.pdfWhich a not a likely location of a bacterial to be found  Atheroscle.pdf
Which a not a likely location of a bacterial to be found Atheroscle.pdfarishmarketing21
 
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdfWhat’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdfarishmarketing21
 
What is the Surface characterization techniques of Fourier-transform.pdf
What is the Surface characterization techniques of Fourier-transform.pdfWhat is the Surface characterization techniques of Fourier-transform.pdf
What is the Surface characterization techniques of Fourier-transform.pdfarishmarketing21
 
What is the running time complexity and space complexity of the follo.pdf
What is the running time complexity and space complexity of the follo.pdfWhat is the running time complexity and space complexity of the follo.pdf
What is the running time complexity and space complexity of the follo.pdfarishmarketing21
 
A species has a diploid number of chromosomes of 6. If a cell from a.pdf
A species has a diploid number of chromosomes of 6. If a cell from a.pdfA species has a diploid number of chromosomes of 6. If a cell from a.pdf
A species has a diploid number of chromosomes of 6. If a cell from a.pdfarishmarketing21
 
What are the security requirements and challenges of Grid and Cloud .pdf
What are the security requirements and challenges of Grid and Cloud .pdfWhat are the security requirements and challenges of Grid and Cloud .pdf
What are the security requirements and challenges of Grid and Cloud .pdfarishmarketing21
 
Using the man command, determine which ls command option (flag) will.pdf
Using the man command, determine which ls command option (flag) will.pdfUsing the man command, determine which ls command option (flag) will.pdf
Using the man command, determine which ls command option (flag) will.pdfarishmarketing21
 
There a six seats in a bar. Your friend took the second seat from th.pdf
There a six seats in a bar. Your friend took the second seat from th.pdfThere a six seats in a bar. Your friend took the second seat from th.pdf
There a six seats in a bar. Your friend took the second seat from th.pdfarishmarketing21
 
The basic economic problem is that we only have so many resources, b.pdf
The basic  economic problem is that we only have so many resources, b.pdfThe basic  economic problem is that we only have so many resources, b.pdf
The basic economic problem is that we only have so many resources, b.pdfarishmarketing21
 
The organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdfThe organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdfarishmarketing21
 
The daisy has which inflorescence morphology type campanulte tubul.pdf
The daisy has which inflorescence morphology type  campanulte  tubul.pdfThe daisy has which inflorescence morphology type  campanulte  tubul.pdf
The daisy has which inflorescence morphology type campanulte tubul.pdfarishmarketing21
 
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdfSuppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdfarishmarketing21
 
Resistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdfResistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdfarishmarketing21
 
Refer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfRefer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfarishmarketing21
 
Q1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdfQ1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdfarishmarketing21
 
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdfarishmarketing21
 
please help with java questionsJAVA CODEplease check my code and.pdf
please help with java questionsJAVA CODEplease check my code and.pdfplease help with java questionsJAVA CODEplease check my code and.pdf
please help with java questionsJAVA CODEplease check my code and.pdfarishmarketing21
 

More from arishmarketing21 (20)

A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdfA series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
 
What is the dangling pointer Explain with a proper example.Solut.pdf
What is the dangling pointer Explain with a proper example.Solut.pdfWhat is the dangling pointer Explain with a proper example.Solut.pdf
What is the dangling pointer Explain with a proper example.Solut.pdf
 
Write a function in javascript that calculates the average element i.pdf
Write a function in javascript that calculates the average element i.pdfWrite a function in javascript that calculates the average element i.pdf
Write a function in javascript that calculates the average element i.pdf
 
Which a not a likely location of a bacterial to be found Atheroscle.pdf
Which a not a likely location of a bacterial to be found  Atheroscle.pdfWhich a not a likely location of a bacterial to be found  Atheroscle.pdf
Which a not a likely location of a bacterial to be found Atheroscle.pdf
 
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdfWhat’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
 
What is the Surface characterization techniques of Fourier-transform.pdf
What is the Surface characterization techniques of Fourier-transform.pdfWhat is the Surface characterization techniques of Fourier-transform.pdf
What is the Surface characterization techniques of Fourier-transform.pdf
 
What is the running time complexity and space complexity of the follo.pdf
What is the running time complexity and space complexity of the follo.pdfWhat is the running time complexity and space complexity of the follo.pdf
What is the running time complexity and space complexity of the follo.pdf
 
A species has a diploid number of chromosomes of 6. If a cell from a.pdf
A species has a diploid number of chromosomes of 6. If a cell from a.pdfA species has a diploid number of chromosomes of 6. If a cell from a.pdf
A species has a diploid number of chromosomes of 6. If a cell from a.pdf
 
What are the security requirements and challenges of Grid and Cloud .pdf
What are the security requirements and challenges of Grid and Cloud .pdfWhat are the security requirements and challenges of Grid and Cloud .pdf
What are the security requirements and challenges of Grid and Cloud .pdf
 
Using the man command, determine which ls command option (flag) will.pdf
Using the man command, determine which ls command option (flag) will.pdfUsing the man command, determine which ls command option (flag) will.pdf
Using the man command, determine which ls command option (flag) will.pdf
 
There a six seats in a bar. Your friend took the second seat from th.pdf
There a six seats in a bar. Your friend took the second seat from th.pdfThere a six seats in a bar. Your friend took the second seat from th.pdf
There a six seats in a bar. Your friend took the second seat from th.pdf
 
The basic economic problem is that we only have so many resources, b.pdf
The basic  economic problem is that we only have so many resources, b.pdfThe basic  economic problem is that we only have so many resources, b.pdf
The basic economic problem is that we only have so many resources, b.pdf
 
The organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdfThe organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdf
 
The daisy has which inflorescence morphology type campanulte tubul.pdf
The daisy has which inflorescence morphology type  campanulte  tubul.pdfThe daisy has which inflorescence morphology type  campanulte  tubul.pdf
The daisy has which inflorescence morphology type campanulte tubul.pdf
 
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdfSuppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
 
Resistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdfResistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdf
 
Refer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfRefer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdf
 
Q1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdfQ1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdf
 
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
 
please help with java questionsJAVA CODEplease check my code and.pdf
please help with java questionsJAVA CODEplease check my code and.pdfplease help with java questionsJAVA CODEplease check my code and.pdf
please help with java questionsJAVA CODEplease check my code and.pdf
 

Recently uploaded

NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17Celine George
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfstareducators107
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17Celine George
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactisticshameyhk98
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 

Recently uploaded (20)

NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 

public class Patient extends Person {=========== Properties ====.pdf

  • 1. public class Patient extends Person { //=========== Properties =============== private int pId; private String address; //=========== Constructors ============= public Patient(){ super();//set 4 properties to blank pId = 0; address = ""; } public Patient(int p,String f,String l,String e, int pi,String a){ super(p,f,l,e);//pass 4 properties to super class pId = pi; address = a; } //=========== Behavior ================= public void setPId( int pi){pId = pi;} public int getPId(){ return pId;} public void setAddress(String a){address = a;} public String getAddress(){ return address;} public void display(){ super.display();//calls display in the super class to display 4 properties System.out.println("Patient Id = A"+getPId()); System.out.println("Address = "+getAddress()); }//end display() public static void main(String args[]){ //Object 1 Patient pa1; pa1 = new Patient();//calls no arg constructor pa1.setPId(900); pa1.setAddress("Marietta"); pa1.display(); System.out.println(" ");//space between to objects
  • 2. //Object 2 Patient pa2; pa2 = new Patient(1234,"Jimmy","Hawkins","jhawkins@yahoo.com",901,"Acworth"); //calls multi argument constructor pa2.display(); }//end main }//end class Let’s make it so that we can look up and find a Patient in the “Patients.txt” file. The Patients are organized by Patients Code. So we should be able to look in the File for Patient “A900”, and it should give us back all the data about that Patient, like, Patinet Id, etc. So we will need to read from the “Patients.txt” file and select the Patient Id “A900”. The File is delimited by “:”(colons). Take a look at the file. use FileInputStream and Buffered reader to read from the file. Code for testing ‘Select’ that goes in main: Patient p1 = new Patient(); p1.select(“A900”); p1.display(); Let’s also make it so that we can add a new Patient to the “Patients.txt” file.use PrintStream and Buffered writer to write to the file. We should be able to append a new line to the “Patients.txt” file with all the data for a new Patient, like PatientId,etc. Code for testing ‘Insert’ that goes in main: Patient p1 = new Patient(); p1.insert(“A900","1234","Jimmy:Hawkins","Marietta","jhawk@yahoo.com","Cigna"); //now go look in file to see if new line was added Solution import java.util.*; public class Patient { private int patientId; private String patientName; private String patientAddress; private String patientPhone; private Date patientDOB; public Patient(int patientId, String patientName, String patientAddress, String patientPhone,
  • 3. Date patientDOB) { // initialise instance variables this.patientId = patientId; this.patientName = patientName; this.patientAddress = patientAddress; this.patientPhone = patientPhone; this.patientDOB = patientDOB; } public void setId (int patientId) { this.patientId = patientId; } public void setName (String patientName){ this.patientName = patientName; } public void setAddress (String patientAddress){ this.patientAddress = patientAddress; } public void setPhone (String patientPhone){ this.patientPhone = patientPhone; } public void setDOB (Date patientDOB){ this.patientDOB = patientDOB; } public int getId () { return patientId; } public String getName () { return patientName; } public String getAddress () { return patientAddress; } public String getPhone () { return patientPhone; }
  • 4. public Date getDOB () { return patientDOB; } } }