Let's build an online lottery system. Imagine that our client is a lottery operator from Tristan da Cunha, and they want to open their lottery to the world.[7]
The lottery operator organises weekly draws, in which punters pick six out of forty possible balls. All the money from lottery tickets goes into the draw pool before the draw. The lottery operator takes a large part of the money for operational costs and the rest is divided amongst the winners. (Money available for prizes is called the payout pool). Several prizes are allocated from this pool, typically grouped by the winning combination. So, for example, 68% of the payout pool is reserved for people who guess correctly all six numbers — they all get a share of the 6-out-of-6 prize. All the winners in the 5-out-of-6 category share 10% of the payout pool, and so on.
Our task is to develop a system that will enable players to purchase tickets and participate in lottery draws. Players will have an online account where they will be able to deposit money with their credit card or by wire transfer. All winnings will be paid into this account automatically when the operator enters draw results into the system , and the players will be able to spend money from the account to buy new tickets or withdraw the money by wire transfer. The operators will typically offer draws for the next two months online.
![]() | Stuff to remember |
|---|---|
|
[7] Tristan de Cunha is the most remote inhabited archipelago in the world. They probably don't have Internet access or a local lottery on the island, but with a bit of imagination, this application will serve well as an example. See http://en.wikipedia.org/wiki/Tristan_da_Cunha.

![[Note]](../images/resources/note.png)


