Working with code R031
package com.example;
import java.time.LocalDate;
import java.util.Objects;
public class LibraryBookLoan {
public final String bookName;
public final LocalDate startDate;
public LibraryBookLoan(String bookName, LocalDate startDate) {
this.bookName = Objects.requireNonNull(bookName);
this.startDate = Objects.requireNonNull(startDate);
}
public LocalDate getDueDate() {
return startDate.plusDays(10);
}
public boolean isOverdue() {
final LocalDate today = LocalDate.now();
return today.isAfter(getDueDate());
}
}Last updated
Was this helpful?

