Explanation: A Better Way With Setters Methods1:32 with Ashley Boucher
Instructions for Workspace
Your instructions are as follows:
1) Change the
out property initialization in the Book class constructor method to
2) Add a setter method called
out() to the Book class. It should receive one argument, a boolean value.
Inside the setter method, set the value of the
_outbacking property to the parameter.
Then, inside the setter method, check the value of the
_outbacking property. If it's
true, calculate the due date and set the Book object's
dueDateproperty. If it's
false, set the
3) Add a getter method to the Book class called
out(). It should return the value of the
_out backing property.
4) Back in the Patron class, refactor your
checkOut() method to use the new
out() setter method instead of your existing code.
You need to sign up for Treehouse in order to download course files.Sign up