Note: This question is part 2 of question #295009 so please answer the take both questions as one question and then answer. please thank you.
c. Book class should include a constructor and the following methods: -
- setBookISBN: to set the ISBN for the book. (Hint: You can use ISBN class input method)
- DisplayBookISBN: to get the ISBN of the book. (Hint: You can use ISBN class method)
- display details: to display all the information of a book which includes Books ISBN, title, authorName, publisherName, Address (Country, City, Street Name and House Number) and price.
Question 2:
Create class diagram of Question-01.
class ISBN:
def __init__(self,ISBNBook):
self.ISBNBook=ISBNBook
def setBookISBN(self):
self.ISBNBook=input("Enter ISBN: ")
class Book(ISBN):
def __init__(self,title,authorName,publisherName,address,price):
self.title=title
self.authorName=authorName
self.publisherName=publisherName
self.address=address
self.price=price
def setBook_ISBN(self):
self.setBookISBN();
self.title=input("Enter title: ")
self.authorName=input("Enter author name: ")
self.publisherName=input("Enter publisher name: ")
self.address=input("Enter address: ")
self.price=float(input("Enter price: "))
def DisplayBookISBN(self):
print(f"ISBN: {self.ISBNBook}")
print(f"Title: {self.title}")
print(f"Author name: {self.authorName}")
print(f"Publisher name: {self.publisherName}")
print(f"Address: {self.address}")
b=Book("title","author name","Publisher name","Address",45)
b.setBook_ISBN()
b.DisplayBookISBN()
Comments
Leave a comment