This program utilizes three classes:
1. Selection
2. Ticket
3. LotteryDemo
Input:
Selection class:
Selection s = new Selection(6,1,49);
System.out.println(s);
might produce an output that looks like this:
Output
06-12-21-28-38-45
Ticket class:
Ticket t = new Ticket("Raymart", 6);
System.out.println(t);
might produce an output that looks like this:
Output
Ticket owner: Raymart
Number of selection(s): 6
-------------------
04-10-21-30-42-45
03-12-17-27-40-42
02-13-14-27-34-44
15-19-21-24-30-31
01-05-16-18-28-31
14-17-23-27-30-49
-------------------
Made by: Sadegh Ghaderpanah
This programs prints lottery ticket. The lottery ticket compares with
an owner selection(s). The prizes are calculated using the
formula m x 10m where m is the number of matches
compares with the list of generated selections.
Putting it all together (LotteryDemo):
Selection winningDraw = new Selection();
Ticket t = new Ticket("Raymart",6);
t.setWinningDraw(winningDraw);
System.out.println(t.toString());
Output
Payout Prize Result
-------------------
Ticket owner: Raymart
Selection(s): 6
Winning draw: 06-12-21-28-38-45
Total prize: $230.0
Summary of prizes:
Selection(s) Prize
----------- -----
04-10-21-30-42-45 $200.00
03-12-17-27-40-42 $10.00
02-13-14-27-34-44 $0.00
15-19-21-24-30-31 $10.00
01-05-16-18-28-31 $10.00
14-17-23-27-30-49 $0.00