can someone pretty please answer my computer science question :( i posted it twice but its the same question
Lab6out implements a lottery game simulation that involves the following 40 images - found in lottery.zip: (Each image is 40x40) 40.bm Thc 40 images reprcscnt 40 lottcry balls uscd in crcating thc simulation. Onc class, namcd Lottery, and a driver function named main are needed for implementing this simulation. Your main function should perform the following steps 1. First, main should prompt the user for the number of lottery balls (.e., numbers) to play C:Windows system321cmd.exe How many lottery balls do you want to play: 6 minimum number of lottery balls is 3, while the maximum number of balls is 10. No data validation need be performed in main - data validation rules in the form of clipping the values will be implemented in the setter of the Lottery class 2. Next, main will use the following setter The setNoBalls to sct the number of lottery balls (i.c., numbers) that the uscr wants to play. (see Required Functions section below for detailed description). In this example, the number of balls (i.e., numbers) is equal to 6. Note: Perform the following steps in main is the user has entered a value at the above prompt that is not between 3 and 10 inclusivelv a. Check return valuc of setNoBalls - The return value will be false if its input paramcter is lcss than 3 or grcater than 10 inclusivcly. Display an informational message in main informing the user that he has entered an b. invalid value for the number of lottery numbers The setter - setNoBalls - will then automatically set the number of balls (i.e., numbers) to play based on the following rules c. If input 10 then no balls-10 In other words, the input parameter will be clipped to the min/max possible values 3. Next, main will prompt thc uscr for thc lottcry numbcrs. Thc number of prompts will bc cqual to the no balls entered in step 2. For this example the user will be prompted for 6 numbers. The first of these prompts are show below: C:Windowslsystem321cmd.exe How many lottery balls do you want to play: 6 Enter lottery # 1
: Entering 'y' repeats the entire program again entering n' stops the program Note: The winnings are not accumulated for each time the user repeats the program Instead, the winnings are newy computed each time and only corresponds to the current set ot lottery halls displayed Class Declaration Use the following class declaration for implementing the Lottery class ifndef LOTTERY_H #define LOTTERY H class Lottery privale int no_balls, int matches, public LolleryO, Lottery) int getNokallso bool SatNaBalsint no bal s) bool addNumberint oum void selectionSort void insertionSot int getMatches0 int binarySearch int target) #end- Private Datafield Description Utilize the following private datafields when implementing this class int no_balls- The number of lottery balls e., numbers) to be played int yourNumbers-dynamically allocated array of integers containing the numbers that you have entered (added) int* winning Numbers -dynamically allocated array of integers containing the winning numbers that are generated int matches- how many numbers match between the numbers you chose and the winning numbers that were generated Method Description Utilize the following methods for the Lottery class Feel free to implement any additional methods Setters Getters Constructors Destructors Lottery0 sets all datatfields to 0 or NULL -Lottery0 int ge-Matchesi). 'IRetums the # of balls that match int gelNgBallso bool setNoBallsnt no_balls); /Rules for this setter are given in step 3 on page 2 This method should dynamically alocates the winningNumbers and yourNumbers array based on the no_balls input parameter bool adcNumbeint number), This method inserts number corresponding o nput parameter number into the dynamical y alocated array you u e s. The number is inserted at the next un lled e ement subscripts slart with subscript 0 and end with no balls -1. The input paramelers nunber represents the lollery number entered by the user in main and to be inserted into the yourNumbers array by this method. The method returns Talse if either of the following failing cond tion cccurs a 1. The number is less than 1 or greater than 40 2. The number is not unique (i.e., it was previously entered) The melhod must nol insert the number if either of the above conditions occu Display the lottery balls corresponding to the numbers that the user has entered. An example of this display is shown at the top of page 3. Gcncratos and displays the winning numbers onc at a timc), and stores cach winning number in the winninaNumbers array, and pertorms the display for cach winning number as outlined on pages 4-7 void salesionsot Performs the selection sort a gorithm on the yourNumbers dynamically allocated array void insstienSort) Pertorms the insertion sort algonthm on the winninaNumbars dynamically allocatod array int binarySearch(int target) Performs the binary search algorithm on the winningNumbers array. The input parameter, target, corresponds to one of your numbers to be searched for within the winninaNumbers array Returns: -1 if target is not found within the winninaNumbers array or Returns: the subscript corresponding to the element of the winningNumbers array that is equal to target int computeWinnings0 Determines the number of matches between your lottery numbers and the winning lottery numbers. The binarySearch method should be used to perform this operation. Once the number of matches have been determined, the winnings is computed in main using the following formula: winnings pow 10.0,matches), (You may have to typecast matches to a double). Returns: The winnings as computed above Guidelines for mairn Your main should perform the following steps 1. Declare one Lottery object 2. Initialize the random number generator 3 Prompt the user for the number of lottery balls to play as shown on page 2 4. Utilize the setNoBalls method with the value entered in step 4 as its input parameter. 5. Prompt the user for his lottery numbers one at a time as shown on page 3. 6. a. Invoke the addNumbers method with each desired lottery number as its input parameter b. Check the return value of addNumbers i. If true, allow the user to enter his next lottery number ii. If false, force the user to re-enter the current lottery number ii. Repeat step b until the user enters the lottery number correctly 7. Invoke the displavYourNumbers method to display the user's selected lottery numbers as shown on page 4 8. Invoke the processWinninaNumbers method to display the winning numbers one at a time and the sorting of the winning numbers as shown on pages 4 thru 7 9. The number of balls played, the number of matches and the total winnings are displayed as shown on page 8. Invoke the getNoBalls, getMatches, and computeWinnnings methods in order to display this information Lab6out implements a lottery game simulation that involves the following 40 images - found in lottery.zip: (Each image is 40x40) 40.bm Thc 40 images reprcscnt 40 lottcry balls uscd in crcating thc simulation. Onc class, namcd Lottery, and a driver function named main are needed for implementing this simulation. Your main function should perform the following steps 1. First, main should prompt the user for the number of lottery balls (.e., numbers) to play C:Windows system321cmd.exe How many lottery balls do you want to play: 6 minimum number of lottery balls is 3, while the maximum number of balls is 10. No data validation need be performed in main - data validation rules in the form of clipping the values will be implemented in the setter of the Lottery class 2. Next, main will use the following setter The setNoBalls to sct the number of lottery balls (i.c., numbers) that the uscr wants to play. (see Required Functions section below for detailed description). In this example, the number of balls (i.e., numbers) is equal to 6. Note: Perform the following steps in main is the user has entered a value at the above prompt that is not between 3 and 10 inclusivelv a. Check return valuc of setNoBalls - The return value will be false if its input paramcter is lcss than 3 or grcater than 10 inclusivcly. Display an informational message in main informing the user that he has entered an b. invalid value for the number of lottery numbers The setter - setNoBalls - will then automatically set the number of balls (i.e., numbers) to play based on the following rules c. If input 10 then no balls-10 In other words, the input parameter will be clipped to the min/max possible values 3. Next, main will prompt thc uscr for thc lottcry numbcrs. Thc number of prompts will bc cqual to the no balls entered in step 2. For this example the user will be prompted for 6 numbers. The first of these prompts are show below: C:Windowslsystem321cmd.exe How many lottery balls do you want to play: 6 Enter lottery # 1 : Entering 'y' repeats the entire program again entering n' stops the program Note: The winnings are not accumulated for each time the user repeats the program Instead, the winnings are newy computed each time and only corresponds to the current set ot lottery halls displayed Class Declaration Use the following class declaration for implementing the Lottery class ifndef LOTTERY_H #define LOTTERY H class Lottery privale int no_balls, int matches, public LolleryO, Lottery) int getNokallso bool SatNaBalsint no bal s) bool addNumberint oum void selectionSort void insertionSot int getMatches0 int binarySearch int target) #end- Private Datafield Description Utilize the following private datafields when implementing this class int no_balls- The number of lottery balls e., numbers) to be played int yourNumbers-dynamically allocated array of integers containing the numbers that you have entered (added) int* winning Numbers -dynamically allocated array of integers containing the winning numbers that are generated int matches- how many numbers match between the numbers you chose and the winning numbers that were generated Method Description Utilize the following methods for the Lottery class Feel free to implement any additional methods Setters Getters Constructors Destructors Lottery0 sets all datatfields to 0 or NULL -Lottery0 int ge-Matchesi). 'IRetums the # of balls that match int gelNgBallso bool setNoBallsnt no_balls); /Rules for this setter are given in step 3 on page 2 This method should dynamically alocates the winningNumbers and yourNumbers array based on the no_balls input parameter bool adcNumbeint number), This method inserts number corresponding o nput parameter number into the dynamical y alocated array you u e s. The number is inserted at the next un lled e ement subscripts slart with subscript 0 and end with no balls -1. The input paramelers nunber represents the lollery number entered by the user in main and to be inserted into the yourNumbers array by this method. The method returns Talse if either of the following failing cond tion cccurs a 1. The number is less than 1 or greater than 40 2. The number is not unique (i.e., it was previously entered) The melhod must nol insert the number if either of the above conditions occu Display the lottery balls corresponding to the numbers that the user has entered. An example of this display is shown at the top of page 3. Gcncratos and displays the winning numbers onc at a timc), and stores cach winning number in the winninaNumbers array, and pertorms the display for cach winning number as outlined on pages 4-7 void salesionsot Performs the selection sort a gorithm on the yourNumbers dynamically allocated array void insstienSort) Pertorms the insertion sort algonthm on the winninaNumbars dynamically allocatod array int binarySearch(int target) Performs the binary search algorithm on the winningNumbers array. The input parameter, target, corresponds to one of your numbers to be searched for within the winninaNumbers array Returns: -1 if target is not found within the winninaNumbers array or Returns: the subscript corresponding to the element of the winningNumbers array that is equal to target int computeWinnings0 Determines the number of matches between your lottery numbers and the winning lottery numbers. The binarySearch method should be used to perform this operation. Once the number of matches have been determined, the winnings is computed in main using the following formula: winnings pow 10.0,matches), (You may have to typecast matches to a double). Returns: The winnings as computed above Guidelines for mairn Your main should perform the following steps 1. Declare one Lottery object 2. Initialize the random number generator 3 Prompt the user for the number of lottery balls to play as shown on page 2 4. Utilize the setNoBalls method with the value entered in step 4 as its input parameter. 5. Prompt the user for his lottery numbers one at a time as shown on page 3. 6. a. Invoke the addNumbers method with each desired lottery number as its input parameter b. Check the return value of addNumbers i. If true, allow the user to enter his next lottery number ii. If false, force the user to re-enter the current lottery number ii. Repeat step b until the user enters the lottery number correctly 7. Invoke the displavYourNumbers method to display the user's selected lottery numbers as shown on page 4 8. Invoke the processWinninaNumbers method to display the winning numbers one at a time and the sorting of the winning numbers as shown on pages 4 thru 7 9. The number of balls played, the number of matches and the total winnings are displayed as shown on page 8. Invoke the getNoBalls, getMatches, and computeWinnnings methods in order to display this information