The Wildcats training rule chooses one instruction. Read the C# chain, rewrite the questions in ordinary words, and then connect the same routes in an activity diagram. An activity diagram shows execution order; despite this page's filename, you are not drawing a UML sequence diagram.
The code below uses the same soccer rule as the C# lesson. Read that lesson if the control statement is unfamiliar.
The inputs numberOfTurns and isGoalkeeper already exist inside the method. The first is a nonnegative integer; the second is a Boolean. The instruction variable stores the chosen text.
string instruction;
if (numberOfTurns >= 3)
{
instruction = "Rest this round";
}
else if (isGoalkeeper)
{
instruction = "Practice saves";
}
else
{
instruction = "Practice passing";
}IF the player has taken at least three turns
Select Rest this round
ELSE IF the player is a goalkeeper
Select Practice saves
ELSE
Select Practice passing
Continue after the choicePseudocode describes the behavior without requiring C# punctuation. Preserve the order, alternatives, and repetition when you simplify the wording. Draw the actions and questions; braces and semicolons do not become nodes.
The conditions become decision diamonds, and the instruction assignments become action boxes. Place the second decision only on the first decision's false route so the diagram preserves the priority of the C# chain.
Three turns already?. Its true arrow reaches Select Rest this round.false arrow to a second diamond labeled Goalkeeper?. Its true arrow reaches Select Practice saves; its false arrow reaches Select Practice passing.Trace a player with 2 turns, first as a goalkeeper and then as a player who is not a goalkeeper. Both paths visit the two diamonds; they select Practice saves and Practice passing, respectively. Neither path visits the other instruction action.