-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEBook.java
More file actions
22 lines (19 loc) · 893 Bytes
/
EBook.java
File metadata and controls
22 lines (19 loc) · 893 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 EBook extends Book {
private final String fileFormat; // The file format of the eBook
// Constructor to initialize the eBook's attributes
public EBook(String title, int numberOfPages, String publisher, String author, String[] primaryCharacters, String fileFormat) {
super(title, numberOfPages, publisher, author, primaryCharacters);
this.fileFormat = fileFormat;
}
// Provides a description of the eBook
@Override
public void describeMaterial() {
System.out.println("This is an eBook in " + fileFormat + " format.");
super.describeMaterial();
}
// Returns a string representation of the eBook
@Override
public String toString() {
return "EBook [Title: " + title + ", Author: " + author + ", File Format: " + fileFormat + ", Pages: " + numberOfPages + ", Publisher: " + publisher + "]";
}
}