Methode payfees hinzugefügt und korrigiert

pull/2/head
elarturo 2024-11-19 10:09:40 +01:00
parent 43324565e5
commit 6bfc94ad33
1 changed files with 60 additions and 52 deletions

View File

@ -6,14 +6,18 @@ import java.util.List;
public abstract class User {
private String id;
private String name;
private double annualFee; // Jahresgebühr
private double outstandingFees; // Ausstehende Gebühren
private List<Medium> borrowedMedia;
private String role; // "admin", "user", "student", "scholar"
public User(String id, String name, double annualFee) {
public User(String id, String name, double annualFee, String role) {
this.id = id;
this.name = name;
this.annualFee = annualFee;
this.outstandingFees = 0.0;
this.borrowedMedia = new ArrayList<>();
this.role = role; // Setzt die Rolle des Benutzers
}
public String getId() {
@ -24,8 +28,8 @@ public abstract class User {
return name;
}
public double getOutstandingFees() {
return outstandingFees;
public double getAnnualFee() {
return annualFee;
}
public void addFee(double fee) {
@ -53,12 +57,16 @@ public abstract class User {
borrowedMedia.remove(medium);
}
public String getRole() {
return role;
}
@Override
public String toString() {
return "Benutzer{" +
"ID='" + id + '\'' +
", Name='" + name + '\'' +
", Ausstehende Gebühren=" + outstandingFees +
'}';
return "Benutzer{" + "ID='" + id + '\'' + ", Name='" + name + '\'' + ", Jahresgebühr=" + annualFee
+ ", Ausstehende Gebühren=" + outstandingFees + '}';
}
public double getOutstandingFees() {
return outstandingFees;
}
}