-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMagazine.java
More file actions
23 lines (20 loc) · 1.01 KB
/
Magazine.java
File metadata and controls
23 lines (20 loc) · 1.01 KB
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 Magazine extends ReadingMaterial {
private final int issueNumber; // The issue number of the magazine
private final String publicationDate; // The publication date of the magazine
// Constructor to initialize the magazine's attributes
public Magazine(String title, int numberOfPages, String publisher, int issueNumber, String publicationDate) {
super(title, numberOfPages, publisher);
this.issueNumber = issueNumber;
this.publicationDate = publicationDate;
}
// Provides a description of the magazine
@Override
public void describeMaterial() {
System.out.println("This is a magazine. Issue Number: " + issueNumber + ", Published on: " + publicationDate);
}
// Returns a string representation of the magazine
@Override
public String toString() {
return "Magazine [Title: " + title + ", Issue Number: " + issueNumber + ", Publication Date: " + publicationDate + ", Pages: " + numberOfPages + ", Publisher: " + publisher + "]";
}
}