-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBook.java
More file actions
99 lines (82 loc) · 2.37 KB
/
Book.java
File metadata and controls
99 lines (82 loc) · 2.37 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
public class Book {
private String title;
private String author;
private double userRating;
private int reviews;
private double price;
private int year;
private String genre;
public Book(String title, String author, double userRating, int reviews, double price, int year, String genre) {
this.title = title;
this.author = author;
this.userRating = userRating;
this.reviews = reviews;
this.price = price;
this.year = year;
this.genre = genre;
}
public String getTitle() {
return title;
}
public String getAuthor() {
return author;
}
public double getUserRating() {
return userRating;
}
public int getReviews() {
return reviews;
}
public double getPrice() {
return price;
}
public int getYear() {
return year;
}
public String getGenre() {
return genre;
}
public void setTitle(String title) {
this.title = title;
}
public void setAuthor(String author) {
this.author = author;
}
public void setUserRating(double userRating) {
this.userRating = userRating;
}
public void setReviews(int reviews) {
this.reviews = reviews;
}
public void setPrice(double price) {
this.price = price;
}
public void setYear(int year) {
this.year = year;
}
public void setGenre(String genre) {
this.genre = genre;
}
public void printDetails() {
System.out.println("Title: " + title);
System.out.println("Author: " + author);
System.out.println("User Rating: " + userRating);
System.out.println("Reviews: " + reviews);
System.out.println("Price: $" + price);
System.out.println("Year: " + year);
System.out.println("Genre: " + genre);
System.out.println("------------------------");
}
@Override
public String toString() {
return "Book{" +
"title='" + title + '\'' +
", author='" + author + '\'' +
", userRating=" + userRating +
", reviews=" + reviews +
", price=" + price +
", year=" + year +
", genre='" + genre + '\'' +
'}';
}
}