***************** *Gegenstand.java* ***************** package src; public abstract class Gegenstand implements Comparable{ public abstract String toString(); } ************* *Lesbar.java* ************* package src; public interface Lesbar { public String getTitel(); public String getAuthor(); public int seiten(); public String leseSeite(int n); } ************ *Druck.java* ************ package src; public abstract class Druck extends Gegenstand implements Lesbar { //---------------------------------------------------------------- //class variables private String author; private String titel; protected String[] text; protected final int maxseiten=100; //---------------------------------------------------------------- //constructors public Druck(String author,String titel){ this.author=author; this.titel=titel; text=new String[maxseiten]; } //---------------------------------------------------------------- //public methods public String toString() { return getAuthor()+": "+getTitel(); } public String getTitel() { return titel; } public void setTitel(String titel) { this.titel=titel; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author=author; } public int compareTo(Object o) { if (o instanceof Druck){ Druck d=(Druck)o; return d.toString().compareTo(toString()); } else { return -100; } } } *********** *Buch.java* *********** package src; public class Buch extends Druck { private int seiten; public Buch(String author, String titel) { super(author,titel); seiten=0; } public void addSeite(String s){ if (text.length==seiten-1){ //resize if not enough space int len=text.length+maxseiten; String [] newtext=new String[len]; int m = Math.min(text.length, len); for(int i=0;iinventory.length-1) || (j<0 || j>inventory.length-1)){ System.out.println("i:"+i+",j:"+j+",max:"+(inventory.length-1)); System.out.println("Bibliothek:swap:Index i or j out of bounds!"); System.exit(0); //beende } //swap Druck tmp=inventory[i]; inventory[i]=inventory[j]; inventory[j]=tmp; boolean tmp2=entlehnt[i]; entlehnt[i]=entlehnt[j]; entlehnt[j]=tmp2; } private void resize(int len){ //check if (len<0){ System.out.println("Bibliothek:resize:variable " + "'len' must be >=0!"); System.exit(0); //beende } //resize Druck [] newinv=new Druck[len]; boolean[] newentlehnt=new boolean[increment]; int m = Math.min(inventory.length, len); for(int i=0;i