class Rational {

    Rational(int numerator, int denominator) {
        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
    }

    int getNumerator() {
        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
    }

    int getDenominator() {
        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
    }

    @Override
    public String toString() {
        return String.format("%d/%d", this.getNumerator(), this.getDenominator());
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null || !this.getClass().isAssignableFrom(obj.getClass())) {
            return false;
        }

        Rational other = (Rational) obj;
        return this.getNumerator() == other.getNumerator()
            && this.getDenominator() == other.getDenominator();
    }
}

class Rational {

    Rational(int numerator, int denominator) {
        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
    }

    int getNumerator() {
        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
    }

    int getDenominator() {
        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
    }

    @Override
    public String toString() {
        return String.format("%d/%d", this.getNumerator(), this.getDenominator());
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null || !this.getClass().isAssignableFrom(obj.getClass())) {
            return false;
        }

        Rational other = (Rational) obj;
        return this.getNumerator() == other.getNumerator()
            && this.getDenominator() == other.getDenominator();
    }

    @Override
    public int hashCode() {
        int prime = 31;
        int result = 1;
        result = prime * result + this.getNumerator();
        result = prime * result + this.getDenominator();

        return result;
    }
}

Add hashCode method to starter solution
Add hashCode method to starter solution
