// TODO equals �berschreiben (Preis und Format NICHT ber�cksichtigen) public boolean equals(Tontraeger obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Tontraeger other = (Tontraeger) obj; if (equals == null) { if (other.equals != null) return false; } else if (!equals.equals(other.equals)) return false; if (genre != other.genre) return false; if (interpret == null) { if (other.interpret != null) return false; } else if (!interpret.equals(other.interpret)) return false; if (label == null) { if (other.label != null) return false; } else if (!label.equals(other.label)) return false; if (titel == null) { if (other.titel != null) return false; } else if (!titel.equals(other.titel)) return false; return true; } public static void main(String[] args) { System.out.println("�bung 9.6 Tontr�gerliste"); System.out.println("------------------------"); boolean equal = false; // TODO Feld musik mit Inhalt anlegen Tontraeger musik[] = new Tontraeger [4]; musik[0] = new Tontraeger("White Album", "The Beatles", "The Beatles", "Apple Record", "34,11", GENRE.VERSCHIEDENE, FORMAT.LPVINYL); musik[1] = new Tontraeger("White Album", "The Beatles", "The Beatles", "Apple Record", "18,51", GENRE.VERSCHIEDENE, FORMAT.CD); musik[2] = new Tontraeger("Sultans Of Swing", "Dire Straits", "Dire Straits", "Mercury (Universal Music)", "15,59", GENRE.ROCK, FORMAT.CD); musik[3] = new Tontraeger("Aqualung", "Jethro Tull", "Jethro Tull", "Parlophone Label Group", "16,56", GENRE.ROCK, FORMAT.CD); for (int i = 0; i < musik.length; i++) { equal = false; // TODO kommt ein Tontr�ger doppelt vor? (�berschriebenes equals verwenden) for (int j = i + 1; j < musik.length; j++) { if (musik[i].equals(musik[j])) System.out.printf("\"%s\" von \"%s\" kommt mehrfach vor\n",musik[i].titel,musik[i].interpret); } } } }