practice exam question please help

Nov 22 2014 11:46 AM

In a simplified lotto game, six numbers between 1 and 49 are generated for a player and one number also between 1 and 49 is generated for the computer. The computer's number is then compared with each of the six numbers of the player. If there is a match the player wins.

• Create a new "Windows Form" project "Question 2" and create an interface as in Figures 2.1
and 2.2.

• The form contains a globally defined object to create random numbers.

• When the "Play" button is clicked:

o Randomly generate six numbers between 1 and 49 for the player. o Use a globally defined array to store the generated numbers.
o Display the generated numbers in a listbox.

o The label is used to specify the number of draws.

o For the computer- generate a random number between 1 and 49 and display it in a
textbox.

o Count the number of wins and the number of losses. A win is determined by comparing
the computer's generated number to see if it matches a number in the array of the player.

• When the "Show" button is clicked, the number of losses and number of wins should be
displayed in the ListBox.



Answers (4)