-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComicBook.java
More file actions
22 lines (19 loc) · 940 Bytes
/
ComicBook.java
File metadata and controls
22 lines (19 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public class ComicBook extends Book {
private final String illustrator; // The illustrator of the comic book
// Constructor to initialize the comic book's attributes
public ComicBook(String title, int numberOfPages, String publisher, String author, String[] primaryCharacters, String illustrator) {
super(title, numberOfPages, publisher, author, primaryCharacters);
this.illustrator = illustrator;
}
// Provides a description of the comic book
@Override
public void describeMaterial() {
System.out.println("This is a comic book illustrated by " + illustrator + ".");
super.describeMaterial();
}
// Returns a string representation of the comic book
@Override
public String toString() {
return "ComicBook [Title: " + title + ", Author: " + author + ", Illustrator: " + illustrator + ", Pages: " + numberOfPages + ", Publisher: " + publisher + "]";
}
}