public class Book {
    String title;
    int count=9;
    
    

    public Book(String title) {
        this.title = title;
        
        
    }
    

     

    public int getCount(){

        return this.count;
       

    }


     



     

    


    

public class Test{


    public void tester(){

        Book moby= new Book("Moby dick");
        Book mockingbird= new Book("mockingbird");
        moby.getCount();
        mockingbird.getCount();
        moby.Id();
        mockingbird.Id();

    }



    public static void main(String args[]){

        Book moby= new Book("Moby dick");
         moby.getCount();
         System.out.println(count);
    }


}

}
@Override
public String toString() {
    return "Book{" +
            "id=" + id +
            ", title='" + title + '\'' +
            '}';
}
|           int Id.nextInt(100);
';' expected
import java.util.UUID;

public class Book {
    public int id;
    public String title;
    public int bookCount = 0;

    public Book(String title) {
        this.id = int.randomint();
        this.title = title;
        bookCount++;
    }

    public String getTitle() {
        return title;
    }

    public static int getBookCount() {
        return bookCount;
    }

  

    public static void main(String[] args) {
        Book book1 = new Book("The Catcher in the Rye");
        Book book2 = new Book("To Kill a Mockingbird");
        System.out.println(book1.getId() + " - " + book1.getTitle());
        System.out.println(book2.getId() + " - " + book2.getTitle());
        System.out.println("Book count: " + Book.getBookCount());
    }
}
public class Title {
    public int id;
    public String title;
    public static int bookCount = 0;
  
    public Title(String title) {
      this.id = ++bookCount;
      this.title = title;
      
    }
  
    public int getId() {
      return id;
    }
  
    public String getTitle() {
      return title;
    }
  
    public static int getBookCount() {
      return bookCount;
    }
  
    
  
    public static void main(String[] args) {
      Title book1 = new Title("Berlin boxing club");
      Title book2 = new Title("Moby dick");
  
      System.out.println(book1.toString());
      System.out.println(book2.toString());
      System.out.println("Book count: " + Title.getBookCount());
  }
  
  @Override
  public String toString() {
      return "Book ID: " + id + ", Title: " + title;
  }
  
  }
  
  
  
  
  Title.main(null);
Book ID: 3, Title: Berlin boxing club
Book ID: 4, Title: Moby dick
Book count: 4
public class Title {
    ///declare field variables
    private int id;
    private String title;
    public static int bookCount = 0;
  //constructer for title and also sets the id using bookcount variable
    public Title(String title) {
        this.id = ++Title.bookCount;
        this.title = title;    
    }
  //getters for id and title important when displaying data
    public int getId() {
        return id;
    }
  
    public String getTitle() {
        return title;
    }
  
    public static int getBookCount() {
        return Title.bookCount;
    }
  
    @Override
    public String toString() {
        return "Book ID: " + id + super.hashCode() + ", Title: " + title;
    }
  
    public static void main(String[] args) {
        Title book1 = new Title("Berlin boxing club");
        Title book2 = new Title("Moby dick");

        System.out.println(book1);  // tostring already embedded within the object when creating tostring because by default the object has it
        System.out.println(book2); 
         System.out.println("Book count: " + Title.getBookCount());
    }
}


Title.main(null);
Book ID: 1333418593, Title: Berlin boxing club
Book ID: 21014082057, Title: Moby dick
Book count: 2
import java.time.LocalDateTime;

public class Book {

    //declare field variables
    private int id;
    private String title;
    private LocalDateTime dateAdded;
    
    //constructer that sets title, time added and id using bookcount variable
    public Book(String title) {
        this.id = ++Title.bookCount;
        this.title = title;
        this.dateAdded = LocalDateTime.now();
    }
    
    //getters which are essential when displaying data
    public int getId() {
        return id;
    }
    
    public String getTitle() {
        return title;
    }
    
    public LocalDateTime getDateAdded() {
        return dateAdded;
    }
    // this calculates how long the book is there since added
    public int shelfLife() {
        LocalDateTime now = LocalDateTime.now();
        int shelfLife = now.getYear() - dateAdded.getYear();
        return shelfLife;
    }
    //this uses conditionals to determine if book is too old and needs to come off
    public boolean shouldComeOffShelf() {
        int shelfLife = shelfLife();
        if (shelfLife >= 5) {
            return true;
        } else {
            return false;
        }
    }
}
//extending book sub class of parent class book 
class Novel extends Book {
    private String author;
    
    public Novel(String title, String author) {
        super(title);
        this.author = author;
    }
    
    public String getAuthor() {
        return author;
    }
}
//extending book sub class of parent class book 
class Textbook extends Book {
    private String publisher;
    
    public Textbook(String title, String publisher) {
        super(title);
        this.publisher = publisher;
    }
    
    public String getPublisher() {
        return publisher;
    }
}

class Title {
    public static int bookCount = 0;
    
    public static void main(String[] args) {
        Novel novel = new Novel("As a man thinketh", "James allen");
        Textbook textbook = new Textbook("Intro to calc Ab", "Pearson");
        
        System.out.println(novel.getTitle() + " by " + novel.getAuthor() + ", Book ID: " + novel.getId() + ", Shelf Life: " + novel.shelfLife() + " years");
        System.out.println(textbook.getTitle() + " by " + textbook.getPublisher() + ", Book ID: " + textbook.getId() + ", Shelf Life: " + textbook.shelfLife() + " years");
        
        if (novel.shouldComeOffShelf()) {
            System.out.println(novel.getTitle() + " should come off the shelf");
        } else {
            System.out.println(novel.getTitle() + " should not come off the shelf yet");
        }
        
        if (textbook.shouldComeOffShelf()) {
            System.out.println(textbook.getTitle() + " should come off the shelf");
        } else {
            System.out.println(textbook.getTitle() + " should not come off the shelf yet");
        }
        
        System.out.println("Book count: " + Title.bookCount);
    }
}

Title.main(null);
As a man thinketh by James allen, Book ID: 1, Shelf Life: 0 years
Boy in the striped pajamas by Pearson, Book ID: 2, Shelf Life: 0 years
As a man thinketh should not come off the shelf yet
Boy in the striped pajamas should not come off the shelf yet
Book count: 2
import java.util.ArrayList;

public class BookShelf {
    public static void main(String[] args) throws InterruptedException {
        // Construct some books and add them to a library
        ArrayList<Book> library = new ArrayList<>();
        library.add(new TextBook("Intro to calc"));
        library.add(new Novel("As a man thinketh"));
        library.add(new Novel("Berlin boxing club"));

        // Let's wait for 5 seconds (5000 milliseconds) to pass
        Thread.sleep(5000);

        // Check which books need to be removed from the shelf
        for (Book book : library) {
            if (book.isExpired()) {
                System.out.println(book.getTitle() + " - Expired");
                
            } else {

                System.out.println(book.getTitle() + " - Available");
               
            }
        }
    }
}

//Parent class book is created takes in title
public abstract class Book {
    private String title;
    private long constructionTime;

    //constructer for book
    public Book(String title) {
        this.title = title;
        this.constructionTime = System.nanoTime();
    }

    //getter for title
    public String getTitle() {
        return title;
    }
//getter for time
    public long getConstructionTime() {
        return constructionTime;
    }
//getter for shelf life calculates shelf life
    public long getShelfLife() {
        long currentTime = System.nanoTime();
        long shelfLife = currentTime - constructionTime;
        return shelfLife;
    }
//uses is expired to check for the book
    public abstract boolean isExpired();
}
//subclass of book
public class TextBook extends Book {
    private static final long SHELF_LIFE = 3000;

    public TextBook(String title) {
        super(title);
    }

    public boolean isExpired() {
        long shelfLife = getShelfLife();
        return shelfLife > SHELF_LIFE;
    }
}
//subclass for book
public class Novel extends Book {
    private static final long SHELF_LIFE = 365 * 24 * 60 * 60 * 1000000000L; // 1 year in nanoseconds
    private int returnStamps = 0;

    public Novel(String title) {
        super(title);
    }

    public void addReturnStamp() {
        returnStamps++;
    }

    public boolean isExpired() {
        long shelfLife = getShelfLife();
        long shelfLifeLeft = SHELF_LIFE - shelfLife;

        if (shelfLifeLeft <= 0) {
            return true;
        } else {
            long renewalThreshold = 3 * 365 * 24 * 60 * 60 * 1000000000L; // 3 years in nanoseconds
            if (returnStamps >= 3 && shelfLifeLeft <= renewalThreshold) {
                returnStamps = 0;
                return false;
            } else {
                return true;
            }
        }
    }
}
BookShelf.main(null);
Intro to calc - Available
As a man thinketh - Available
Berlin boxing club - Available