Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this problem you will simulate a lottery drawing. The user will be asked to

ID: 3695964 • Letter: F

Question

For this problem you will simulate a lottery drawing. The user will be asked to enter a number between 1 and 99 (including 1 and 99) and this number will be compared to a lottery number that has been randomly generated. When the user’s number and the lottery number are the same the user will win $5000. When the user’s number is the reverse of the lottery, e.g. 91 and 19, the user wins $3000. When the user’s number contains one number in common with lottery number, the user wins $100. (Suppose the lottery number was 19, the user could win $100 for having 1, 9, 10, 11, 12, 90, 92, 93, etc.) Using a loop, allow the user to “play” the lottery as many times as he/she would like. This loop should keep track of how many times the user “played” the lottery and the total that the user won from all the drawings. After the loop has completed (the user does not want to “play” again) calculate how much the user has spent if each time of playing the lottery costs $10.25 as well the total he/she won. The output should be similar to You spent $30.75 to win $100.00. Inside the loop, prompt the user to enter whole numbers between 1 and 99 (including 1 and 99). Use a loop to test and prompt the user to re-enter their lottery number if it is not in the range specified. Once a proper number is entered, determine the user’s winnings by generating a random number from 1 to 99 (including 1 and 99), then use the if-elseif structure to determine the winnings for this “play” of the lottery. You should use the floor function and the rem function to generate the first and last digits of the random number. The if-elseif structure should have 4 branches and the last branch should be an else.

FOR MATLAB Please

Explanation / Answer

int main() { // Variable Declarations int lottery[5] = {0, 0, 0, 0, 0}; int user[5] = {0, 0, 0, 0, 0}; int matches = 0; //Function Calls generateLottery(lottery, SIZE, lotteryDigits); userInput(user, SIZE); matchCounter(lottery, user, matches); displayNumbers(lottery, user); winnerOrLoser(matches); system("pause"); return 0; } //end main //======================================================================================= // -------------------- // Function Definitions // -------------------- //======================================================================================= // Randomly generates winning lottery numbers int generateLottery(int lottery[], int, int) { unsigned seed = time(0); srand(seed); for (int y=0; y> user[y]; } } return user[0], user[1], user[2], user[3], user[4]; } // end userInput //======================================================================================= // Counts the number of matches int matchCounter(int lotto[], int input[], int) { int match = 0; for (int x = 0; x
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote