Labor – Linked Lists

Erstelle eine Linked List für Personen.

GenderFEMALE, MALE, OTHERPersonname:StringbirthDate:LocalDategender: Genderweight:intConstructor(name:String, birthDate:LocalDate,gener:Gender, weight:int)setName(name:String)setBirthDate(birthDate:LocalDate)setGender(gender: Gender)setWeight(weight:int)equals(other: Person): booleancompareTo(other: Person): inttoString(): StringprintInfo(title:String)strip name param, thencheck null, len 3..30check null, after nowbefore 1900-01-01null for unknowncheck 2..200by name, birthDate; no weight!1. birthDate, 2. name, 3. weightuse "%s" PersonNodenext: PersonNodepayload: PersonConstructor(payload: Person)Constructor(payload: Person, next: PersonNode)setNext(next: PersonNode)setPayload(payload: Person)getters(): their_return_typeequals(): booleancompareTo(): inttoString(): Stringnull if end of listnever null (we forbid "holes")is identtiy defined by personor also by the position?returns the result ofPerson::compareTo PersonLinkedListnode0: PersonNodeget(idx: int): PersonNodefirst(): PersonNodelast(): PersonNodesize(): intisEmpty(): booleanindexOf(person: Person): intadd(person: Person)add(personNode: PersonNode)remove(person: Person)swap(idx1: int, idx2: int)sort()

If use of enum is causing problems, let it away for now. Use String.format(..) and System.out.format(..) "EVERYWHERE"!