All pastes #477837 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-08 21:26 UTC
rendered paste body
import java.util.*;


/**
 *
 * @author Gruppe 477534
 * @version 1.0
 *
 */
public class Hochschule {

	private Vector<Person> personen;

	public Hochschule(){

	}

	public void addPerson(Person p){
		if(personen.contains(p)){
			System.out.println("true");
		}
		else{
			System.out.println("false");
		}

	}

	/**
	 * Hauptprogramm.
	 * @param args Kommandozeilenparameter
	 */
	public static void main(String[] args){

		Hochschule aalen = new Hochschule();

		Student student1 = new Student("Riedel", "Martin", "Steigerweg",
				73431, "Aalen", 07361, 370614,
				26241, 2, "Informatik", "Bachelor");
		Student student2 = new Student("Riedel", "Martin", "Steigerweg",
				73431, "Aalen", 07361, 370614,
				26241, 2, "Informatik", "Bachelor");

		aalen.addPerson(student1);
		aalen.addPerson(student2);

	}
}

public boolean equals( Object o )
	  {
	    if ( o == null )
	      return false;

	    if ( o == this )
	      return true;

	    if ( ! o.getClass().equals(getClass()) )   //instanceof liefert true, falls o auch eine Unterklasse ist
	      return false;

	    Student that = (Student) o;

	    //Vergleich der Attribute der Objekte
	    return    this.Matrikelnummer == that.Matrikelnummer;
	  }