Skip to content
Advertisement

creating a java lottery program that allows the user to select the number of players

I am creating a lottery program that uses a set to store the numbers. The user inputs their number, and it’s stored in a set, then the computer generates some random number, and this is stored in a different set also. The 2 sets are then compared, and the intersect is taken out.

The user can select the number of weeks to run the lottery program i.e. each week the computer generates new values and checks them against the user number.

I’m supposed to make the code run for a varying amount of players i.e the user should be able to select how many players for each week and the code should print out what each player got per week.

JavaScript

I’m able to create a fixed amount of players to play but I can’t figure out how to allow the user to select the number of players they want

Advertisement

Answer

Create a List of “players”.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement