package assign2startercode;

/**
 * @author macisac
 * @version 1.8.0
 * 
 */

public class Doctor {

	private String firstName;
	private String lastName;
	private String specialty;

	public Doctor() {
		this.firstName = null;
		this.lastName = null;
		this.specialty = null;
	}

	public Doctor(String lastName, String firstName, String specialty) {
		this.firstName = firstName;
		this.lastName = lastName;
		this.specialty = specialty;
	}

	@Override
	public String toString() {
		return lastName + ", "+ firstName  + ", " + specialty ;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getSpecialty() {
		return specialty;
	}

	public void setSpecialty(String specialty) {
		this.specialty = specialty;
	}
	
	@Override
	public boolean equals(Object obj) {
		
		if (obj == null)
			return false;
		
		if( !(obj instanceof Doctor))
			return false;
		
		Doctor d = (Doctor)obj;
		
		if(this.getFirstName().equals(d.getFirstName())  && this.getLastName().equals(d.getLastName()) && this.getSpecialty().equals(d.getSpecialty()))
			return true;
		
		return false;	
	}
	
	

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
		result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
		result = prime * result + ((specialty == null) ? 0 : specialty.hashCode());
		return result;
	}


	
}//end class definition
