public override bool CanBorrow(Library_Item li) { //method to check whether faculty member can borrow library item bool borrow = false; //library item could be book or journal, need to get type of a certain item. if (li.GetType() == typeof(Book)) { // staff can only borrow up to four books and the item must available. if (BooksCount <= FacBookMax && li.isAvailable()) { borrow = true; } } if (li.GetType() == typeof(Journal)) { //staff can only borrow up to two journals and the journal must available. if (JournalsCount <= FacJournalMax && li.isAvailable()) { borrow = true; } } return(borrow); }
private DateTime myDueDate; //the item’s due date public Loan(Library_Item li, DateTime bdate, DateTime rdate) { //set the construct myItem = li; myDateBorrowed = bdate; myDueDate = rdate; }
//method to find the library item from the list of borrowed items public Loan findBorrowedItem(Library_Item li) { Loan aitem = null; foreach (Loan theitem in myItems) { if (theitem.Item.Equals(li)) { aitem = theitem; } } return(aitem); }
public override bool CanBorrow(Library_Item li) { //method to check whether student can borrow library item bool borrow = false; if (li.GetType() == typeof(Book)) { //student can only borrow up to two book and it must be available if (BookCount <= StudentBookMax && li.isAvailable()) { borrow = true; } } return(borrow); }
public Library_Item findItem(int callnum) { //find an item based on call number Library_Item anitem = null; //if two call number equals then it is the same one foreach (Library_Item theitem in myItems) { if (theitem.CallNum.Equals(callnum)) { anitem = theitem; } } return(anitem); }
public override void removeBorrowedItem(Library_Item bItem) { //method to remove borrowed item ItemsBorrowed.Remove(findBorrowedItem(bItem)); }
//abstract method to remove borrowed item from the list public abstract void removeBorrowedItem(Library_Item bItem);
private static int nextID = 1000; //variable used to generate unique ID //abstract method to check whether member is allowed to borrow library item public abstract bool CanBorrow(Library_Item li);