Skip to content

Instantly share code, notes, and snippets.

@AntonioJuliano
Created July 5, 2016 23:24
Show Gist options
  • Save AntonioJuliano/7bee3e43f36bf6e4737a8355c04b8f0d to your computer and use it in GitHub Desktop.
Save AntonioJuliano/7bee3e43f36bf6e4737a8355c04b8f0d to your computer and use it in GitHub Desktop.
Introduction
You have been hired by the agency that runs the state lottery to design a strategy for managing the interaction between the lottery's central office and the "lottery terminals" in stores throughout the state. Your task in this assignment is to write a memo describing your proposed design, and discussing how well your design meets the criteria set out below. You will be graded partly on your design, and partly on your analysis and critique of your own design.
How the Lottery Works
Lottery tickets are sold for $1 each and can be bought from lottery terminals that are placed in convenience stores throughout the state. Each lottery ticket must have at least three things printed on it: the identity of the terminal that printed it, a timestamp (of up to 1 millisecond accuracy) that marks when it was printed, and a "lucky number" which is an integer between 0 and 9,999,999 inclusive. You may add additional information to each ticket. Lottery tickets go on sale at 8:00 AM every Monday, and can be bought until 11:00 PM on Saturday. Lottery terminals are programmed to refuse to dispense tickets between 11:00 PM Saturday and 8:00 AM Monday.
At 11:30 PM every Saturday, a random number generator in the central lottery office generates the "weekly drawing" which is a randomly chosen integer between 0 and 9,999,999 inclusive. On Sunday, anybody who has a ticket that (a) was sold within the last week, and (b) has a lucky number that matches the weekly drawing, can turn in that ticket. The lottery agency has one week to validate the ticket; if it is successfully validated, the person who turned it in gets $5,000,000 in cash. Any number of winning tickets, or none at all, might exist. Each valid winning ticket gets $5,000,000.
Tickets are dispensed by lottery terminals, which are small hardware devices that the lottery agency leases to the owners of convenience stores throughout the state. The store puts the terminal next to the store's cash register. A customer who wants to buy a lottery ticket enters his or her chosen lucky number by pressing buttons on the terminal, or the customer presses a special button asking the terminal to generate a lucky number randomly. The customer then pays the store clerk $1. Finally, the store clerk presses a button that causes the terminal to dispense the ticket to the customer.
At the end of the week, each store tells the lottery agency how many tickets the store sold that week. The store gives the lottery ninety cents for each sale that the store reports; the store gets to keep the other ten cents.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment