info-java/Buch.java
2024-09-27 10:54:08 +02:00

34 lines
799 B
Java

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