Powerball

Write a program that reads in a text file containing Powerball numbers. Pick random Powerball numbers, then for each line of input, display how many numbers matched and the "payout".

For Powerball, the first five numbers should be 1-69, and the last number is from 1-26. In the text file, the last number is the Powerball number.

Files Needed:

Here are the payout details:

MatchesPrize
Powerball only (0+1)$4
1 number plus PB (1+1)$4
2+1$7
3+0$7
3+1$100
4+0$100
4+1$50,000
5+0$1,000,000
5+1Jackpot!

What You Should See

This week's Powerball drawing:  8-27-34-4-19, PB: 10

11 41 61 62 63 16 - 0 match $0
21 33 45 52 59 25 - 0 match $0
19 24 29 30 62 11 - 1 match $0
17 41 48 50 65 2 - 0 match $0
21 23 49 51 52 5 - 0 match $0
9 28 40 56 62 3 - 0 match $0
30 43 45 57 61 22 - 0 match $0
6 14 31 32 64 22 - 0 match $0
6 25 31 47 52 26 - 0 match $0
9 32 38 54 62 9 - 0 match $0
27 30 33 54 67 16 - 1 match $0
3 7 37 62 66 16 - 0 match $0
13 16 22 65 67 3 - 0 match $0
5 6 21 48 58 25 - 0 match $0
21 39 57 58 63 18 - 0 match $0
2 4 7 39 41 17 - 1 match $0
2 7 9 17 34 9 - 1 match $0
31 35 39 54 55 4 - 0 match $0
5 14 29 45 51 24 - 0 match $0
3 13 34 36 60 6 - 1 match $0



©2013–2016 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License