From ee38827437e68f35c3917c4b2561c370fd4385d5 Mon Sep 17 00:00:00 2001 From: elarturo Date: Mon, 18 Nov 2024 23:04:42 +0100 Subject: [PATCH] abstrakte Klasse Medium mit abstrakten Methoden --- .../src/DomainLayer/Medium.java | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 Bibliotheksverwaltung/src/DomainLayer/Medium.java diff --git a/Bibliotheksverwaltung/src/DomainLayer/Medium.java b/Bibliotheksverwaltung/src/DomainLayer/Medium.java new file mode 100644 index 0000000..9921a25 --- /dev/null +++ b/Bibliotheksverwaltung/src/DomainLayer/Medium.java @@ -0,0 +1,77 @@ +package DomainLayer; + +import java.time.LocalDate; + +public abstract class Medium { + private String id; + private String title; + private String releaseYear; + private boolean isBorrowed; + private LocalDate borrowDate; + private LocalDate dueDate; + private int renewals; + + public Medium(String id, String title, String releaseYear) { + this.id = id; + this.title = title; + this.releaseYear = releaseYear; + this.isBorrowed = false; + this.renewals = 0; + } + + public String getId() { + return id; + } + + public String getTitle() { + return title; + } + + public String getReleaseYear() { + return releaseYear; + } + + public boolean isBorrowed() { + return isBorrowed; + } + + public void setBorrowed(boolean borrowed) { + this.isBorrowed = borrowed; + } + + public LocalDate getDueDate() { + return dueDate; + } + + public void setDueDate(LocalDate dueDate) { + this.dueDate = dueDate; + } + + public int getRenewals() { + return renewals; + } + + public void increaseRenewals() { + this.renewals++; + } + + public void resetRenewals() { + this.renewals = 0; + } + + // Abstrakte Methoden + public abstract int getBorrowPeriod(); + public abstract boolean isRenewable(); + public abstract int getMaxRenewals(); + + // Neue Methode für den Autor + public abstract String getAuthor(); + + public LocalDate getBorrowDate() { + return borrowDate; + } + + public void setBorrowDate(LocalDate borrowDate) { + this.borrowDate = borrowDate; + } +}