code von priority repariert
parent
2a28e3a16e
commit
010057da87
|
@ -1,15 +1,15 @@
|
||||||
package Queue;
|
package Queue;
|
||||||
|
|
||||||
import java.sql.Date;
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.PriorityQueue;
|
||||||
|
|
||||||
public class Reklamation implements Comparable<Reklamation> {
|
public class Reklamation implements Comparable<Reklamation> {
|
||||||
String kundennr;
|
String kundennr;
|
||||||
Date datum;
|
LocalDate datum;
|
||||||
String beschreibung;
|
String beschreibung;
|
||||||
Prioritaet prio;
|
Prioritaet prio;
|
||||||
|
|
||||||
public Reklamation(String string, Date datum, String b, Prioritaet prio) {
|
public Reklamation(String string, LocalDate datum, String b, Prioritaet prio) {
|
||||||
this.kundennr = string;
|
this.kundennr = string;
|
||||||
this.datum = datum;
|
this.datum = datum;
|
||||||
this.beschreibung = b;
|
this.beschreibung = b;
|
||||||
|
@ -32,15 +32,17 @@ public class Reklamation implements Comparable<Reklamation> {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
PriorityQueue<Reklamation> reklamationen = new PriorityQueue<>();
|
PriorityQueue<Reklamation> reklamationen = new PriorityQueue<>();
|
||||||
reklamationen
|
reklamationen
|
||||||
.add(new Reklamation("Lisa Mayer", new Date(1234567890), "Handybildschirm kaputt", Prioritaet.BRONZE));
|
.add(new Reklamation("Lisa Mayer", LocalDate.of(2009, 2, 14), "Handybildschirm kaputt", Prioritaet.BRONZE));
|
||||||
reklamationen.add(new Reklamation("Hanna Montana", new Date(1234567900),
|
reklamationen.add(new Reklamation("Hanna Montana", LocalDate.of(2009, 2, 14),
|
||||||
"20 Laptops müssen vor Sa repariert werden", Prioritaet.GOLD));
|
"20 Laptops müssen vor Sa repariert werden", Prioritaet.GOLD));
|
||||||
reklamationen.add(new Reklamation("Herbert Grönemayer", new Date(1234567910), "braucht neues Softwareupdate",
|
reklamationen.add(new Reklamation("Herbert Grönemayer", LocalDate.of(2009, 2, 14), "braucht neues Softwareupdate",
|
||||||
Prioritaet.SILBER));
|
Prioritaet.SILBER));
|
||||||
reklamationen.add(new Reklamation("KSI", new Date(1234567920), "neue Iphone Bestellung nicht angekommen",
|
reklamationen.add(new Reklamation("KSI",LocalDate.of(2009, 2, 14), "neue Iphone Bestellung nicht angekommen",
|
||||||
Prioritaet.BRONZE));
|
Prioritaet.BRONZE));
|
||||||
|
|
||||||
for (Reklamation reklamation : reklamationen) {
|
|
||||||
|
while (!reklamationen.isEmpty()) {
|
||||||
|
Reklamation reklamation = reklamationen.poll();
|
||||||
System.out.println(reklamation.kundennr + " - " + reklamation.beschreibung + " (" + reklamation.prio + ")");
|
System.out.println(reklamation.kundennr + " - " + reklamation.beschreibung + " (" + reklamation.prio + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue