-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBook.java
More file actions
28 lines (23 loc) · 757 Bytes
/
Copy pathBook.java
File metadata and controls
28 lines (23 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public class Book {
String title;
int publicationYear;
int numPages;
String subject;
Double rating;
public Book(String title, int publicationYear, int numPages, String subject, Double rating){
this.title = title;
this.publicationYear = publicationYear;
this.numPages = numPages;
this.subject = subject;
this.rating = rating;
}
public String toString(){
return "Title: " + title + ", Publication year: " + publicationYear + ", Pages: " + numPages + ", Subject: "
+ subject + ", Rating: " + rating;
}
@Override
public boolean equals(Object obj) {
Book otherBook = (Book) obj;
return this.title == otherBook.title;
}
}