CJCoding With Joseph

Roster Behind a Private List

The 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:
2
Ann, Bob

Expected Output:

2
Ann, Bob
Topics:
Encapsulation
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.