Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
In this video, we'll review the solution to the first challenge and introduce our second challenge—adding two more methods to our media type class.
Instructions
2nd Challenge
- Add a method named
Loan()
that accepts a string of the name of the person who is borrowing the item.- Store the person's name in a new field named
Loanee
. - Use a boolean field,
OnLoan
, to indicate whether or not an item has been loaned out.
- Store the person's name in a new field named
- Add a method named
Return()
that resets the loan related fields to their default values.-
null
for theLoanee
field andfalse
for theOnLoan
field.
-
- Update the
GetDisplayText()
method to include the loan related fields if the item is on loan.- For example, if an album is currently on loan, it should display the text "Album: Yellow Submarine by The Beatles (Currently on loan to Joe Smith)".
- Test your changes by updating the Program.cs file
Main()
method to call theLoan()
andReturn()
methods.
Help
If you get stuck on any of the following topics or simply need a refresher, click on a topic in list below to view the associated video in the C# Objects course.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up