import java.lang.Comparable;

class Foo implements Comparable<Foo> {
	private int id;
	private float score;
	String name;

	public Foo(int i, float s, String n) {
		id = i;
		score = s;
		name = n;
	}

	public int getID() { 
		return id;
	}

	@Override
	public boolean equals(Object o) {
		if (!(o instanceof Foo)) {
			return false;
		}

		Foo that = (Foo) o;
		
		return (this.id == that.id &&
			Math.abs(this.score - that.score) < 0.000001 &&
			this.name.equals(that.name)); 
	}

	@Override
	public int hashCode() {   // better way - using Bloch's solution
		int result = 17;

		result += 31 * result + id;  // for int type 
		result += 31 * result + Float.floatToIntBits(score); // floats
		result += 31 * result + name.hashCode();  // ref types

		return result;
	}

	public int compareTo(Foo that) {
		return name.compareTo(that.name);
	}
	
	@Override
	public String toString() {
		return "" + name;
	}
}
