954,554 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

lottery program help

how would i write the code to get this output?


Play a pick four game?
(enter Y to play pick four, anything else for pick 3)
y
How many chances do you want to buy?
5
Your bets:
[[10, 6, 16, 9], [14, 4, 2, 12], [3, 16, 16, 16], [3, 6, 16, 10], [18, 20, 7, 15]]
The winning numbers were:
[3, 7, 2, 24]
Your net income from playing the lottery: -5 dollars
cicero {~/teaching/Spring2006/cs2/lab1} >java App
Play a pick four game?
(enter Y to play pick four, anything else for pick 3)
N
How many chances do you want to buy?
8
Your bets:
[[1, 25, 11], [2, 15, 23], [16, 5, 12], [19, 23, 14], [19, 23, 12], [10, 23, 15], [23, 22, 24], [17, 9, 12]]
The winning numbers were:
[21, 8, 13]
Your net income from playing the lottery: -8 dollars

x2k3wl
Newbie Poster
2 posts since Feb 2006
Reputation Points: 10
Solved Threads: 0
 

Greetings:
I don`t quite understand your question, but from reading your other post (I think you should have posted this in the other post), i think that using an array for the bets wouldn`t be the best answer, why dont you create a class that "hosts" the bets with four variables, in case that the user only choose 3 you can set the other one to null, then you just create as many objects as you need of that class for the bets and use any method you prefer to keep track of them, like a Vector

ROGENATOR
Newbie Poster
17 posts since Sep 2005
Reputation Points: 11
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You