Question: Java programming.? Write a regression test for Patient Class. Test each method. Might need some fixing. /Person.java /** * The model of a person who
Java programming.?
Write a regression test for Patient Class. Test each method. Might need some fixing.
/Person.java /** * The model of a person who has a name and a health number * that cannot be changed. */ public abstract class Person { /** * The name of the person. */ private String pname; /** * The health number of the person. */ private int healthNum; private int age; private String address; /** * Initialize an instance with the given name and health number. * * @param pName the person's name * @param pNumber the person's health number */ public Person(String pname, int age, String address) { this.pname = pname; this.age = age; this.address = address; } /** * Return the name of the person. * * @return the name of the person */ public String getName() { return pname; } /** * Return the health number of the person. * * @return the health number of the person */ public int getHealthNumber() { return healthNum; } /** * Change the name of the person. * * @param newName the name of the person */ public void setName(String newName) { pname = newName; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } /** * Return a string representation of the person. * * @return a string representation of the person */ @Override public String toString() { return "Name: "+pname+" Age: "+age+" Address: "+address; } } /** * A method to test the Person class. */
//Patient.java import java.util.LinkedList; public class Patient extends Person{ String bedReference; LinkedList
// Doctor.java import java.util.LinkedList; import java.util.List; public class Doctor extends Person implements BasicDoctor{ String department; int experience; public List
// Surgeon.java import java.util.List; public class Surgeon extends Doctor{ public Surgeon(String name, int age, String address, int experience, String department) { super(name, age, address, experience, department); } @Override public String toString() { return "Surgeon: "+name+" Age: "+getAge()+" Address: "+getAddress()+" Designation: "+department+" With experience of: "+experience; } }
// interface BasicDoctor.java
// all are in package card
public interface BasicDoctor {
public Person checkUp() throws Exception;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
