Implement hashcode and equals method in java
import java.util.*;
public class Student {
private int id;
private String firstName, lastName;
private boolean paidFees;
public Student(int id, String firstName, String lastName, boolean paidFees) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.paidFees = paidFees;
}
public int getId() {
return id;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public boolean hasPaidFees() {
return paidFees;
}
public String toString() {
return firstName + " " + lastName + " (ID: " + id + ")" + ( paidFees ? "" : " (Fees Owed)");
}
// TODO: Implement the equals() method
// this is an equals method
// two students are equal if they have the same id, first name, last name and paidFees
// IGNORE CASE for first name and last name
@Override
public boolean equals(Object obj) {
return false;
}
// TODO: Implement the hashCode() method
// this is an hashcode method, check the slides and the book for more information and requirements
// REMINDER: the hashcode method must follow the following rules:
// Symmetry: if a.equals(b) is true then b.equals(a) must be true
// Reflexivity: a.equals(a) must be true
// Transitivity: if a.equals(b) is true and b.equals(c) is true then a.equals(c) must be true
// Consistency: multiple calls of a.equals(b) must return the same value
@Override
public int hashCode() {
return 0;
}
}