After reading Sections 9.6.2 and 9.6.3, write constraints for a RoundRobinStyle class and a RoundRobinRound class, implementing the TournamentStyle and the Round interfaces, respectively. Assume that RoundRobinStyle plans a series of Rounds so that each Player is paired with the other Players exactly once in the Tournament. Note that the number of Rounds depends on whether the number of Players in the Tournament is odd or even, and that a given Player cannot play more than once in a given Round.

What will be an ideal response?


```
/* If the number of players is even, the number of rounds is one less than the
* number of players. Otherwise, it is equal to the number of players */
context RoundRobinStyle::planRounds(t:Tournament) post:
if (t.players.size.mod(2) = 0) then
result->size = t.players.size - 1
else
result->size = t.players.size
endif
/* Each player plays each other in a RoundRobinStyle tournament.
context RoundRobinStyle::planRounds(t:Tournament) post:
t.players->forAll(p:Player|
p.getMatches(t).players->includesAll(t.players))
```

Computer Science & Information Technology

You might also like to view...

Visual Basic access keys are created by using which symbol in a button's Text property?

(A) @ (B) & (C) % (D) #

Computer Science & Information Technology

Create a movie that has a JPEG image rotating in it.

What will be an ideal response?

Computer Science & Information Technology

In the quadratic probe, the increment is the square root of the collision probe number.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

A(n) ____ combines the system unit and monitor into one.

a. desktop b. laptop c. all-in-one d. tablet PC

Computer Science & Information Technology