Question: The ui and code for this question You will write an application to simulate a lottery game. Your program wit generate seven unique random lottery

The ui and code for this question
The ui and code for this question You will write an application

You will write an application to simulate a lottery game. Your program wit generate seven unique random lottery numbers for the player, and stoce them in an integer array. Then, the program will choose six winning lottery numbers, alse storicg these in another array. Once al the numbers are selected, the program will compare the player's numbers against the wintire numbers, to evaluate how maery of the numbers match. Sample Outcome Flayer numberst \begin{tabular}{|l|l|l|l|l|l|l|} \hline 45 & 2 & 31 & 17 & 3 & 16 & 22 \\ \hline 27 & 16 & 18 & 12 & 1 & 45 \\ \hline \end{tabular} Choose 7 numbers for player Winning numbers: Choose 6 numbers for computer Outcome: There are 2 Matches (the values 45 amd 16 apprar in boch greupl) Generating a Random Number The following code snippet demonstrates how to generate a random number between 1 and 49 and store that number in a variable: Randoe reg = new fanden( ). / /rereates the Randon object anstance Structuring the Prosram Efficienthy Create user defined methods in your code as follows. These user detined methods should be called vpon to generate and diplay the player numbers ard the ainniog mamben, and when comparing the teo to determine the number of matches. a) private vold GenerateNunbers\{[nt[] nunArray) - This method accepts one integer array as an input parameter - arrays are passed by referescie. hence there is no need to pass back the array to the calling method. - This method will boo through the array cenerating random namben between 1 and 49 - To make sure that the same number is not used fwice, we will require a second loop finside the first locpl that checks that the number has not been uned betore. Do Nor allow bupucatis within the arrays! b) private string Budldstring(int[] nundrray) - Inside this meshod, loop through the array that is pasied in and append each element to a atring varlable. - Retven this strine to the caling mechos. This method should not probuce ary evtput on screent c) private Let Corparedrrays(int:[] arrd, int[] arrz) - This method will logp through one of the arraps. fach element of thin array will be chiccied againat all elements of the second aeray fusing esther ancther loop or possbily an Array methoel. checking lor a manch, - if a match is found, inorement a variable holding the mumber of matching walues w when done. this "match count" value is passed back to the calling method. PhoG 1224 Lab 1 Winter 2097 Design/User Interface Determine how so preient this came to the user in an attractive and easy to shientand manter, so that they can complete the following actions: 1. Generate the values and compare for matches (py ') 2. Display a message based on the outcome (how many matches) 3. Reset the game / play again Lab Pequirements You will wemit vour UWP application. Your asp must include the folowing: - Name your project LabiYowrName (substifute your own name ef counel) - A well designed interface to allow the user to interact with the proeram - The arravi to store the two hets of integer values - User-defined methods as described above. - Lopcaty and synacrically conec code to respond to the user's actoons and diplay the desied resuets - Code should be commented, tabbed/fomatied correctly, and well ocganined - Dbjectr and variables should be named appropriately

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!