Bibliothek/Buch.java aktualisiert

This commit is contained in:
Denys Konovalov 2024-09-27 10:54:47 +02:00
parent 8bcc8e8a02
commit f8e091216c

@ -1,33 +1,33 @@
public class Buch { public class Buch {
private String title; private String title;
private String author; private String author;
public String ISBN; public String ISBN;
private int count; private int count;
Buch(String newTitle, String newAuthor, String newISBN, int newCount) { Buch(String newTitle, String newAuthor, String newISBN, int newCount) {
title = newTitle; title = newTitle;
author = newAuthor; author = newAuthor;
ISBN = newISBN; ISBN = newISBN;
count = newCount; count = newCount;
} }
public boolean ausleihen() { public boolean ausleihen() {
if (count > 0) { if (count > 0) {
count--; count--;
return true; return true;
} else { } else {
return false; return false;
} }
} }
public void zurueckgeben() { public void zurueckgeben() {
count++; count++;
} }
public void buchInfo() { public void buchInfo() {
System.out.printf("Titel: %s\n", title); System.out.printf("Titel: %s\n", title);
System.out.printf("Autor: %s\n", author); System.out.printf("Autor: %s\n", author);
System.out.printf("ISBN: %s\n", ISBN); System.out.printf("ISBN: %s\n", ISBN);
System.out.printf("Verfügbar: %s\n", count); System.out.printf("Verfügbar: %s\n", count);
} }
} }