Picking those winning lottery numbers! Your mom loves playing the lottery each w
ID: 3880961 • Letter: P
Question
Picking those winning lottery numbers! Your mom loves playing the lottery each week, but she always takes forever to pick a set of numbers. It's driving you crazy because, who does she send to the store to get her lottery tickets? You! Wonderful child that you are, you've decided to help her by writing a program that will pick some numbers for her. Awesome! Think about how you can do this. Your mom likes to play both Fantasy 5 and the regular Lotto (6 numbers), so you want to write a program that takes this in account. For Fantasy 5, the range of possible numbers should be from 1- 36 For the Lotto, the range of possible numbers should be from 1 - 53 Don't worry about whether you get duplicate numbers (we haven't learned enough about that yet) Assume that you will be given a method that gives you one random number Think about how you want to present her number picks to her. You'll want to be sure to great her and include some enthusiastic text along with her numbers (e.g., "Here are your winning numbers!') For Part 1, write an algorithm for your winning lottery number program, and then do several iterations of tests (i.e., step through your algorithm to make sure that it is logically correct and gives you the correct output). Put this in a Word or Open Office document. You'll turn that document in with the program that you create in Part 2.Explanation / Answer
ALGORITHM:
1. Make the following initialization:
fantasyfive_number = 0
lotto_number = 0
2. while fantasyfive_number < 1 OR fantasyfive_number > 36:
- fantasyfive_number = generaterandom()
3. while lotto_number < 1 OR lotto_number > 53:
- lotto_number = generaterandom()
4. Print 'Here are your winning numbers!"
5. Print "lotto number = ", lotto_number
6. Print "fantasyfive number = ", fantasyfive_number
7. END
Above is the algorithm as asked in question.