I am losing my mind trying to compare two objects with one another, for example:
System.out.println("Equals? " + bob.equals(alice));
Which would return true if both objects contain the same "PIN" and familyNumber" . Issue being I have no idea how to compare the two values at the same time . My current attempt is below, and beneath that is the code being used
public boolean equals(Patient patientTwo) //i hate this
{
if((getHealthID()).equals.patientTwo.getHealthID())
{
if((getPIN) == (patientTwo.getPIN))
{
return true;
}
else return false;
}
else return false;
}
public Patient()
{
age = 0;
name = "no_name";
patientHealthID = patientHealthID; //NEEDS WORK - GIVEN identical VALUE UNTIL SOLUTION FOUND
vaccineStatus = false; //Possibly unnecessary
}
public Patient(String name, int age, HealthID newHealthID)
{
this.age = age;
this.name = name;
patientHealthID = newHealthID; //NEEDS WORK
vaccineStatus = false;
}
public HealthID()
{
familyNumber = nextFamilyNumber;
PIN = nextPIN;
nextFamilyNumber++; //MAY HAVE TO REMOVE
nextPIN++;
}
public HealthID(int familyNumber)
{
this.familyNumber = familyNumber; //UNSURE IF CORRECT
PIN = nextPIN;
nextPIN++;
}