-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBook.java
102 lines (96 loc) · 2.15 KB
/
Book.java
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
100
101
102
/*
* Created by Noah Shaw
*/
public class Book {
//Attributes
private String name;
private String author;
private int yearPublished;
private String publisher;
private int ISBN;
private int pageCount;
//Constructors
public Book() //Default
{
this.name = "";
this.author = "";
this.yearPublished = 0;
this.publisher = "";
this.ISBN = 0;
this.pageCount = 0;
}
public Book(String aName, String aAuthor, int aYearPublished, String aPublisher, int aISBN, int aPageCount) //Parameter
{
this.setName(aName);
this.setAuthor(aAuthor);
this.setYearPublished(aYearPublished);
this.setPublisher(aPublisher);
this.setISBN(aISBN);
this.setPageCount(aPageCount);
}
//Accessors
public String getName()
{
return this.name;
}
public String getAuthor()
{
return this.author;
}
public int getYearPublished()
{
return this.yearPublished;
}
public String getPublisher()
{
return this.publisher;
}
public int getISBN()
{
return this.ISBN;
}
public int getPageCount()
{
return this.pageCount;
}
//Mutators
public void setName(String aName)
{
this.name = aName;
}
public void setAuthor(String aAuthor)
{
this.author = aAuthor;
}
public void setYearPublished(int aYearPublished)
{
this.yearPublished = aYearPublished;
}
public void setPublisher(String aPublisher)
{
this.publisher = aPublisher;
}
public void setISBN(int aISBN)
{
this.ISBN = aISBN;
}
public void setPageCount(int aPageCount)
{
this.pageCount = aPageCount;
}
//Methods
public String toString()
{
return "Name: "+this.name+" Author: "+this.author+" Year Published: "+this.yearPublished+" Publisher: "+this.publisher+" ISBN: "+this.ISBN+" Page Count: "+this.pageCount+"\n";
}
public boolean equals(Book aBook)
{
return aBook != null &&
this.name.equalsIgnoreCase(aBook.getName()) &&
this.author.equalsIgnoreCase(aBook.getAuthor()) &&
this.yearPublished == aBook.getYearPublished() &&
this.publisher.equalsIgnoreCase(aBook.getPublisher()) &&
this.ISBN == aBook.getISBN() &&
this.pageCount == aBook.getPageCount();
}
}