print("Testing User.py:", "\n") print("\n") print("Testing Librarian and its functions:", "\n") librarian = Librarian("Awantik", "Bangalore", 34, 'asljlkj22', 'zeke101') print(librarian) librarian.addBook('Shoe Dog', 'Phil Knight', '2015', 312) librarian.addBookItem("Shoe Dog", '123hg', 'H1B2') librarian.addBookItem("Shoe Dog", '124hg', 'H1B4') librarian.addBookItem("Shoe Dog", '125hg', 'H1B5') librarian.addBook('Moonwalking with Einstien', 'J Foer', '2017', 318) librarian.addBookItem('Moonwalking with Einstien', '463hg', 'K1B2') librarian.addBookItem('Moonwalking with Einstien', '466hg', 'K1B5') librarian.displayAllBooks() librarian.removeBookItemFromCatalog("125hg") librarian.displayAllBooks() librarian.removeBook("Shoe Dog") librarian.displayAllBooks() librarian.addBook('Shoe Dog', 'Phil Knight', '2015', 312) librarian.addBookItem("Shoe Dog", '123hg', 'H1B2') librarian.addBookItem("Shoe Dog", '124hg', 'H1B4') librarian.addBookItem("Shoe Dog", '125hg', 'H1B5') librarian.displayAllBooks() librarian.searchBook() print("\n\n") print("Testing Student and its functions:", "\n") m1 = Member("Vish", "Bangalore", 23, 'asljlkj22', 'std1233') print(m1) m1.issueBook("Moonwalking with Einstien", 5) m1.books_issued m1.displayAllBooks()
from Book import Book from Catalog import Catalog from User import Member, Librarian catalog = Catalog() #reference to Librarian class object librarian = Librarian("Awantik","Bangalore",34,'asljlkj22','zeke101') #details of librarian print (librarian) # adding a book by librarian b2 =librarian.addBook("This is Going to Hurt: Secret Diaries of a Junior Doctor","Adam Key",'2017', 302,catalog) #adding details librarian.addBookItem(b2,'234c','l203',catalog) #displaying all the books till now added librarian.displayAddedBook(catalog) #library remove book librarian.removeBook('Shoe Dog',catalog) librarian.addBookItem(b2,'235c','1204',catalog) librarian.removeBookItemFromCatalog(catalog,"This is Going to Hurt: Secret Diaries of a Junior Doctor",'235c')
lib.addBook('Shoe Dog','Phil Knight', "2015",400) lib.addBookItem("Shoe Dog", "isbn1", "H1B1") lib.addBookItem("Shoe Dog", "isbn3", "H1B2") lib.displayAllBooks() lib.addBook('Progrmming','imran khan', "1999",500) lib.addBookItem("Progrmming", "isbn4", "H1C1") lib.addBookItem("Progrmming", "isbn6", "H1C2") lib.displayAllBooks() lib.addBook('Python','reema thareja', "200",320) lib.addBookItem("Python", "isbn7", "H1D1") lib.addBookItem("Python", "isbn9", "H1D2") lib.displayAllBooks() lib.removeBook("Python") lib.displayAllBooks() lib.removeBookItemFromCatalog("isbn1") lib.displayAllBooks() m1 = Member("Sharma", "Ap", 20, "AA990", "STUID112") print(m1) m1.searchByName("Shoe Dog") m1.searchByAuthor('imran khan') m1.displayAllBooks()
lib = Librarian('Gopal', 'Indore', 24, '994400555515', 'GOP975') print(lib) lib.addBook('Thermodynamics', 'P.K. Nag', 'June 1989', '1279') lib.addBookItem('Thermodynamics', 'BTXPB5929C', 'T101') lib.addBookItem('Thermodynamics', 'BTXPB5929C', 'T102') lib.addBook('Machine Design', 'R.S. Khurmi', 'Februaru 1990', '2087') lib.addBookItem('Machine Design', 'CDFTC6432B', 'M201') lib.addBookItem('Machine Design', 'CDFTC6432B', 'M201') lib.addBook('Theory of Machines', 'Dr. A.G. Ambekar', 'September 1985', '2745') lib.addBookItem('Theory of Machines', 'SMNQS6664A', 'TM301') lib.addBookItem('Theory of Machines', 'SMNQS6664A', 'TM302') lib.viewBooks() lib.removeBookItem('SMNQS6664A') lib.viewBooks() lib.removeBook('Theory of Machines') lib.viewBooks() member1 = Member('Aditya', 'Indore', 24, '9424534453', 'ADI942') member2 = Member('Harish', 'Indore', 25, '9791457862', 'HAR979') print(member2) member1.viewBooks() member1.reserveBook('Thermodynamics') member2.reserveBook('Machine Design') member1.viewBooks() lib.viewissuedBookItems() lib.viewIssuerInfo() member1.returnBook() member2.returnBook()
lib = Librarian("Sumit yadav", "Mumbai", 30, "PUNE199", "JSPM1111") print(lib) lib.addBook("Crack IELTS", "Pravin Choudhari", "2015") lib.addBookItem("Crack IELTS", "001aa", "B1") lib.addBookItem("Crack IELTS", "002aa", "B2") lib.addBook("Crack coding round", "Saurabh Jadhav", "2002") lib.addBookItem("Crack coding round", "001ab", "C1") lib.addBookItem("Crack coding round", "002ab", "C2") lib.addBook("Theory of everything", "Stephen hawking", "2012") lib.addBookItem("Theory of everything", "001ac", "D1") lib.addBookItem("Theory of everything", "002ac", "D2") lib.addBookItem("Theory of everything", "003ac", "D2") lib.viewBooks() lib.removeBookItem("001ac") lib.viewBooks() lib.removeBook("Crack coding round") lib.viewBooks() member1 = Member("Ashwani Devesh Kashyap", "Mumbai", 23, "ADK4321", "NESS4321") member2 = Member("Shivani Kashyap", "Surat", 19, "SK1234", "MSU8765") member3 = Member("Navneet Kashyap", "Patna", 21, "NK9876", "JSPM1715") print(member1) print(member2) print(member3) member1.viewBooks() member1.search_by_book_name("Theory of everything") member1.search_by_book_name("The magic of thinking big") member1.search_by_author_name("Stephen Hawking") member1.search_by_author_name("JK rowling") member1.issue_book("Theory of everything", 8)
catalog.removeBookItem('Shoe Dog', '124hg') catalog.displayAllBooks() # serching a book b = catalog.searchByName('Shoe Dog') print(b) #librarian object librarian = Librarian("Awantik", "Bangalore", 34, 'asljlkj22', 'zeke101') # librarian adding book l = librarian.addBook(catalog, 'How to write clean code', 'David', '2020', 150) l1 = Book('How to write clean code', 'David', '2020', 150) # librarian adding book items librarian.addBookItem(l, '1234hg', 'H1B2') librarian.addBookItem(l, '1235hg', 'H1B2') catalog.displayAllBooks() # librarian removing bookitem we need to paas class object for calling class methods librarian.removeBookItemFromCatalog(catalog, l1, 'How to write clean code', '1234hg') # librarian removing book librarian.removeBook(catalog, 'Shoe Dog') # memeber Object m1 = Member("Vish", "Bangalore", 23, 'asljlkj22', 'std1233') # member is issuing book and then system will update our inventory m1.issueBook(catalog, b1, 'Shoe Dog') catalog.displayAllBooks() # when member returns a book,then system will update our inventory m1.returnBook(catalog, b1, 'Shoe Dog') catalog.displayAllBooks()
lib = Librarian("John Doe", "Mumbai", 30, "AJSK8549", "EMP58964") print(lib) lib.addBook('Shoe Dog', 'Phil Knight', "Biography", '2015') lib.addBookItem("Shoe Dog", "123pk", "H1B1") lib.addBookItem("Shoe Dog", "124pk", "H1B2") lib.addBook('Kafka On The Shore', 'Haruki Murakami', "Fiction", "2002") lib.addBookItem("Kafka On The Shore", "854hm", "C1B1") lib.addBookItem("Kafka On The Shore", "685hm", "C1B2") lib.addBook('The Fault In Our Stars', 'John Green', "Romance", "2012") lib.addBookItem("The Fault In Our Stars", "957jg", "R1B1") lib.addBookItem("The Fault In Our Stars", "985jg", "R1B2") lib.viewBooks() lib.removeBookItem("985jg") lib.viewBooks() lib.removeBook("The Fault In Our Stars") lib.viewBooks() member1 = Member("Niel", "Mumbai", 23, "ABCD4321", "STUD4321") member2 = Member("Nitin", "Mumbai", 23, "DCBA4321", "STUD8765") print(member2) member1.viewBooks() member1.searchByTitle("Kafka On The Shore") member1.searchByTitle("Rich Dad Poor Dad") member1.searchByAuthor("Phil Knight") member1.searchByAuthor("Robert Kiyosaki") member1.searchByCategory("Fiction") member1.searchByCategory("Self Help") member1.searchByPublicationDate("2015") member1.searchByPublicationDate("2013") member1.reserveBook("Shoe Dog")
m1 = Member("Vish", "Bangalore", 23, 'asljlkj22', 'std1233') m2 = Member("Chaitali", "Pune", 28, 'chaitali123', 'HS1166') m3 = Member("Jane", "Punr", 25, 'jane123', 'HS1177') librarian = Librarian("Awantik", "Bangalore", 34, 'asljlkj22', 'zeke101') print(m1) print(librarian) #m1.issueBook librarian = Librarian("Awantik", "Bangalore", 34, 'asljlkj22', 'zeke101') lib1 = librarian.addBook('Lean In', 'Sheryl Sandberg', 2018, 600) catalog.addBookItem(lib1, '454hs', 'H1B6') catalog.addBookItem(lib1, '456hs', 'H1B7') lib2 = librarian.addBook('Harry Potter', 'J.K.Rowling', 2013, 600) catalog.addBookItem(lib2, '545hs', 'H2B1') catalog.addBookItem(lib2, '656hs', 'H2B2') librarian.removeBook('Harry Potter') Catalog.books = [] Catalog.diff_count = 0 m1.issueBook('Lean In') m2.issueBook('Lean In') m1.returnBook('Lean In') catalog.displayLibrarianDetails()
print(lib) lib.addBook('Shoe Dog', 'Phil Knight', "2015", 312) lib.addBookItem("Shoe Dog", "123pk", "H1B1") lib.addBook('Iron Man', 'Tony Stark', "2001", 800) lib.addBookItem("Iron Man", "123im", "I1B1") lib.addBook('Moonwalking with Einstien', 'J Foer', "2017", 318) lib.addBookItem("Moonwalking with Einstien", "325ad", "A1B1") lib.addBookItem("Moonwalking with Einstien", "326ad", "A1B2") lib.addBook('Harry Potter', 'J K Rowling', "1997", "312") lib.addBookItem("Harry Potter", "854hm", "C1B1") lib.displayAllBooks() lib.removeBookItemFromCatalog("325ad") lib.displayAllBooks() lib.removeBook("Moonwalking with Einstien") lib.displayAllBooks() member1 = Member("Ron", "Pune", 21, "LID547895", "STU343231") member2 = Member("Rhea", "Kerala", 20, "LID43218", "STU656461") member2.searchByName("Shoe Dog") member1.searchByAuthor("Steve") member1.searchByAuthor("Tony Stark") member1.issueBook("Shoe Dog", "123pk") lib.displayAllBooks() member1.returnBook("Shoe Dog", "123pk", "H1B1") lib.displayAllBooks()