-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBook.java
More file actions
69 lines (62 loc) · 1.52 KB
/
Copy pathBook.java
File metadata and controls
69 lines (62 loc) · 1.52 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
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.io.Serializable;
/**
* Te-Feng (Dylan) Pan
* CS 162J Lab 6B : Book Library
* This class stores information about a book.
*/
public class Book implements Serializable
{
private String title, // Title of the book
author, // Author's last name
publisher, // Name of publisher
iSBN;
/**
* This constructor accepts arguments for the title, author, and publisher.
*/
public Book(String textTitle, String auth, String pub, String bknum)
{
title = textTitle;
author = auth;
publisher = pub;
iSBN = bknum;
}
/**
* Copy constructor
*/
public Book(Book object2)
{
title = object2.title;
author = object2.author;
publisher = object2.publisher;
iSBN = object2.iSBN;
}
/**
* The set method sets each field.
*/
public void set(String textTitle, String auth, String pub, String bknum)
{
title = textTitle;
author = auth;
publisher = pub;
iSBN = bknum;
}
/**
* get method retrieves a field
*/
public String getTitle()
{
return title;
}
/**
* The overriding toString method returns book information.
*/
public String toString()
{ String str = " Title: " + title
+ "\n Author: " + author
+ "\n Publisher: " + publisher
+ "\n ISBN: " + iSBN;
return str;
}
}