The Wildcats need a method that accepts a jersey number. A class diagram shows the input contract for every call, not the number used by one call.
This complete Player definition has one public field and one public method with one integer parameter.
If the underlying C# feature is unfamiliar, use the lesson below while reading this example.
public class Player
{
public int jerseyNumber;
public void SetJerseyNumber(int number)
{
jerseyNumber = number;
}
}Define a Player with an integer jerseyNumber field
Offer a public SetJerseyNumber operation
The operation accepts one integer input named number
It stores that input and returns no valueThese words describe the class contract, not a sequence of runtime actions. Identify the types, stored members, operation inputs and results, and relationships before choosing compartments and connectors.
Player.+jerseyNumber : int. This is the member that retains state after a call.+SetJerseyNumber(number : int) : void. Keep the parameter inside the parentheses and the return type afterward.Compare this reference with the diagram you built in Violet. Layout may differ; the source meaning, labels, and relevant connections should agree.
The operation entry accepts different integers without changing the diagram. Calling it with 7 or 12 changes a runtime value, not this signature.