Find the Bugs (5 bugs) // A Patient class is used by a doctor\'s office. // The
ID: 3770097 • Letter: F
Question
Find the Bugs (5 bugs)
// A Patient class is used by a doctor's office.
// The Patient class has two overloaded constructors:
// 1) a default constructor,
// 2) one that requires an ID number, first and last name.
// A demonstration program declares two Patient objects
// and displays each patient's data fields.
start
Declarations
Patient patient1()
Patient patient2("234", "Lee", "Lydia")
patient1.display()
patient2.display()
stop
class Patient
Declarations
private string idNum
private string lastName
private string firstName
public Patient()
idNum = "0000"
lastName = "XXXX"
firstName = "XXXX"
return
public Patient(string id, string last, string first)
idNum = idNum
last = last
firstName = first
return
public void display()
output "Patient #", id, lastName, firstName
return
end
Explanation / Answer
Patient class is used by Doctors'office class
i.e Doctors's office class extends the patient class here Patient is super clas/ base class
Doctors'office is sub class/ derived class
Class name doesn't conatain ( ' ) special symbols
more than one definition for a function name or an operator in the same scope, which is called function overloading and operator overloading respectively.
Patient class has two constructirs with and without parameters
Please make a note:
Constructor must be equal to class name i.e Patient() // default constructor
Patient("234", "Lee", "Lydia") // argumented constructor
Patient1.display() -> Patient# 0000, XXXX, XXXX
Patient2.display() -> Patient# 234, Lee,Lydia,
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.