SlideShare a Scribd company logo
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 existente
Mariano 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.pdf
anandatalapatra
 
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
feetshoemart
 
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
albarefqc
 
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
tdc-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.pdf
akshpatil4
 
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
barristeressaseren71
 
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
MARRY7
 
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
normanibarber20063
 
Java2
Java2Java2
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
ankitmobileshop235
 
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
irshadoptical
 
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
fathimafancy
 
@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
aplolomedicalstoremr
 
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
abc2232
 
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
dhavalbl38
 
Inheritance compiler support
Inheritance compiler supportInheritance compiler support
Inheritance compiler support
Syed 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.pdf
ezhilvizhiyan
 
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
NicholasflqStewartl
 

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.pdf
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 
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
arishmarketing21
 

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

Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 

Recently uploaded (20)

Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.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; } } }