Ask coding questions

← Back to all posts
How do I print this list using my class method?
AureyLia

My only trouble is line 46. How do I print my list items using my method (ToString()) I created under the House class? Right now it's only printing the name of the list...

I want my output to be "House at 123 Main Street has 2 bedrooms and 4 bathrooms." and so on for each list item.

Answered by SixBeeps [earned 5 cycles]
View Answer
Voters
AureyLia
Comments
hotnewtop
SixBeeps

Right now you're trying to print the list itself, not the items of the list. If you want to print out each House element one-by-one, you need to iterate over the whole list and print them like that. Something like

AureyLia

Thank you so much!