-
-
Save jasongorman/c7828930f8afda97c34bf14db3afb431 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Movie { | |
private final String title; | |
private int availableCopies = 1; | |
private List<Member> onLoanTo = new ArrayList<>(); | |
public Movie(String title){ | |
this.title = title; | |
} | |
public void borrowCopy(Member member){ | |
availableCopies -= 1; | |
onLoanTo.add(member); | |
} | |
public void returnCopy(Member member){ | |
availableCopies++; | |
onLoanTo.remove(member); | |
} | |
public String getTitle() { | |
return title; | |
} | |
public int getAvailableCopies() { | |
return availableCopies; | |
} | |
public Boolean isOnLoanTo(Member member) { | |
return onLoanTo.contains(member); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment