package person;
import video.Video;
import book.Book;
import book.Loanable;
import membership.*;
public class Member extends Person {
Membership membertype_;//Member's membership type
private int nBooks_;
private int nVideos_;
public Member(String name,Membership membertype)
{
super(name);
membertype_= membertype;
nBooks_=0;
}
public boolean borrow(Book b)
{
if(b.isLoanable() )
{
Loanable l = (Loanable) b;
if (membertype_.canBorrow(l,nBooks_)){
nBooks_++;
return true;
}
}
return false;
}
public boolean borrow(Video v)
{
if(membertype_.canBorrow(v,nVideos_))
{
nVideos_++;
return true;
}
return false;
}
public String getDetails() {
// TODO Auto-generated method stub
return null;
}
public String toString()
{
return super.toString() + "--Membership type:"+membertype_.toString();
}
}
No comments:
Post a Comment