How can I print this:
AudioBook book = new AudioBook ("Harry Potter", "Joan Rowling",LiteratureGenre.Romance, Locale.CANADA,LocalDate.of(2000, 7, 8),
"Someone name",LocalTime.of(1, 25), 0);
It prints everything, but not this part
"Harry Potter", "Joan Rowling",LiteratureGenre.Romance, Locale.CANADA,LocalDate.of(2000, 7, 8)
This is the constructor and toString method:
public AudioBook(String bookName, String bookAuthor, LiteratureGenre bookGenre, Locale bookLanguage, LocalDate bookDateOfMade,String readerName, LocalTime recordDuration, int priceForDownload) {
super(bookName,bookAuthor,bookGenre, bookLanguage,bookDateOfMade);
this.readerName = readerName;
this.recordDuration = recordDuration;
this.priceForDownload = priceForDownload;
}
@Override
public String toString() {
return "\nThis Audio book belongs to: " + readerName + " \nThe duration of the book is: "
+ recordDuration + " and it's cost: " + priceForDownload + "$";
}
What I have tried:
List<Book> books = new ArrayList<>();
AudioBook book = new AudioBook ("Harry Potter", "Joan Rowling",LiteratureGenre.Romance, Locale.CANADA,LocalDate.of(2000, 7, 8),
"Someone name",LocalTime.of(1, 25), 0);
AudioBook book1 = new AudioBook ("Book Name", "Author",LiteratureGenre.Poetry, Locale.UK,LocalDate.of(1965, 12, 5),
"Reader name",LocalTime.of(1, 10), 7);
Book b1 = new Book("Alisa in Wonderland","Anybody",LiteratureGenre.Fiction, Locale.GERMAN, LocalDate.of(2019, 1, 1));
Book b2 = new Book("Dune", "Author",LiteratureGenre.History,Locale.ITALIAN, LocalDate.of(2020, 4, 1));
books.add(b1);
books.add(b2);
books.add(book1);
books.add(book);
System.out.println("<Books>:");
for (Book b : books) {
System.out.println(b);
}