-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibrary Book.py
More file actions
42 lines (32 loc) · 1.27 KB
/
Library Book.py
File metadata and controls
42 lines (32 loc) · 1.27 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
# Including a book into the library records
class Book:
book_title = ""
author = ""
year_of_publication = 0
def __init__(self, book_title, author, year_of_publication):
self.book_title = book_title
self.author = author
self.year_of_publication = year_of_publication
def get_book_title(self):
return self.book_title
def get_author(self):
return self.author
def get_year_of_publication(self):
return self.year_of_publication
def set_book_title(self, book_title):
self.book_title = book_title
def set_author(self, author):
self.author = author
def set_year_of_publication(self, year_of_publication):
self.year_of_publication = year_of_publication
def __str__(self):
return "Book Title:" + "\t"+self.book_title + "\n" + "The Author:" +"\t" + self.author + "\n" +"Year of Publication:" + "\t" + str(self.year_of_publication)
NewBook = Book("Programming", "Wangechy J.T", 2021)
print( "The initial values of the NewBook function")
print(NewBook)
NewBook.set_book_title("Cooking")
NewBook.set_author("Jatavia J.T")
NewBook.set_year_of_publication(2020)
print("\n")
print("The new values of the NewBook function")
print(NewBook )