Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Refer to the attached file, I can't send you the ticket. mat file, can you just come up with a with the code that answers

Refer to the attached file, I can't send you the ticket. mat file, can you just come up with a with the code that answers the other part of the question. I will load the mat data file on my own image text in transcribed

You have been hired to write a script for a lottery system. In this lottery, a player can choose 6 non-repeated numbers between 1 and 49 when purchasing a ticket. The system records the sold ticket according to a unique ticket ID (a number between 1 and 10.000), and stores the 6 numbers printed on the ticket into adata file, called The file contains an Nx7 matrix variable called tickets, Each row corresponds to one sold ticket. The first column is the ticket ID, while the other 6 columns are the chosen numbers on the ticket. On Friday, the lottery corporation randomly draws 6 numbers from a range between 1 and 49 (non-repeating) as the winning numbers of the week. Then, the following rules are applied to determine the prizes for winners: Number of Matched Digits Prize Awarded 50.000 $25.000 4 $1000 100 0-2 Note that the number of matched digitals must be counted according to the order of the winning numbers. Also, the lottery corporation randomly draws 10 ticket IDs as 'extra' winners. Extra' winners each win $100 Now, write a MATLAB script that completes the following: Check to see if the data file ICE6Tic s .mat exists, and if it does load it. Otherwise, terminate your script gracefully by displaying the following message No data file available Suppose the winning numbers of the week is the following (ie, 6 non-repeating numbers between 1 and 49) Lucky numbers: 46 22 16 Randomly choose 10 distinct ticket IDs to award the extra prize. Hint: consider using function randi Display a message in the following format showing the selected ticket IDs (the actual values selected by your script wil be different) Lucky tickets 9510 5810 437 3863 2854 4673 8627 7819 2045 6463 Check each ticket saved in the data file and determine its prize value, including the extra prize if any (set to zero if the ticket is not qualified to any prize). Hint: function find might be useful to determine extra prize. Display a message for each ticket receiving a non-zero total prize in the following format (the actual values shown by your script will be different): Ticket 437: 0 matches, $0 $100 Ticket 2045 2 matches $0 $100 where the first dollar amount is regular prize based on the number of matched digits and the second amount is the extra prize Save the results in an Nx2 variable called prizes, in which the first column is the ticket ID and the second column is the prize amount. Then, store the variable prizes into a data file ICEwinners.mat

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago