import java.math.BigInteger; import java.util.Objects; import java.util.Set; public class studfac { abstract class Person { protected String name; protected int ID; public boolean equals(Object ob) { if (ob == null || ob.getClass() != this.getClass()) return false; return this.ID == ((Person)ob).ID; } public int hashCode() { return Objects.hash(name, ID); //return name.hashCode() ^ ID; } abstract BigInteger getBalance(); } class Course { Course(String newName, int newID) { name = newName; ID = newID; } public boolean equals(Object ob) { if (ob == null || ob.getClass() != this.getClass()) return false; return this.ID == ((Course)ob).ID; } public int hashCode() { return Objects.hash(name, ID); //return name.hashCode() ^ ID; } private String name; private int ID; } class Student extends Person { Student(String newName, int newID, Set newCourses) { name = newName; ID = newID; courses = newCourses; } private Set courses; @Override BigInteger getBalance() { return BigInteger.valueOf(courses.size() * -20); } } class FacultyMember extends Person { FacultyMember(String newName, int newID, Set newCourses) { name = newName; ID = newID; courses = newCourses; } private Set courses; @Override BigInteger getBalance() { return BigInteger.valueOf(courses.size() * 30); } } public static void main(String [] args) { } }