Roster Behind a Private List
hardQuestion 584The Team class hides a private List<string> of member names. Add a method Add(string name) that appends a name, a read-only property Count that returns how many members there are, and a method Roster() that returns the names joined by ", " (a comma followed by a space). The list itself is never exposed. The tester prints Count, then the roster. Do NOT write a Main method.
After adding "Ann" and "Bob" the program prints the output shown in Expected Output.
Expected output
2 Ann, Bob
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
Encapsulation
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cw, cr, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.