-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextbook.java
More file actions
23 lines (20 loc) · 1011 Bytes
/
Textbook.java
File metadata and controls
23 lines (20 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public class Textbook extends ReadingMaterial {
private final String subject; // The subject of the textbook
private final String academicLevel; // The academic level for which the textbook is intended
// Constructor to initialize the textbook's attributes
public Textbook(String title, int numberOfPages, String publisher, String subject, String academicLevel) {
super(title, numberOfPages, publisher);
this.subject = subject;
this.academicLevel = academicLevel;
}
// Provides a description of the textbook
@Override
public void describeMaterial() {
System.out.println("This is a textbook for subject: " + subject + ", Academic Level: " + academicLevel);
}
// Returns a string representation of the textbook
@Override
public String toString() {
return "Textbook [Title: " + title + ", Subject: " + subject + ", Academic Level: " + academicLevel + ", Pages: " + numberOfPages + ", Publisher: " + publisher + "]";
}
}