Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is beginning MATLAB. This wants us to use the function provided to relate the 3 random numbers inputted to an array. Then a SWITCH

This is beginning MATLAB. This wants us to use the function provided to relate the 3 random numbers inputted to an array. Then a SWITCH statement is used to match the value of the numbers drawn to display the correct prize. I have tried this and cant figure it out.

I have taken 3 screenshots so you can see the whole questions and what things the computer will test our function for.

Thank you for your help

image text in transcribed

image text in transcribed

image text in transcribed

Lottery The lottery game matches three different integer numbers between 1 and 10. Winning depends on how many matching numbers are provided by a player. The player provides three different integers between 1 and 10 . If there is a match of all 3 numbers, the winning S 1000 - If there is a match with 2 numbers, the winning S 10 . If there is a match of all with 1 numbers, the winning S 1 .With no match, the winning is S0 Write a function Lottery3 that checks three numbers provided by a player and determine the winning amount. If the user mistakenly enters same number twice/thrice and if that number matches one of the winning numbers, the code should count that number only once and display correct result. The player doesn't have to guess the order of numbers The input to the function Lottery3 can have up to two input arguments. The first input argument is a row array numbers with 3 numbers. If the second argument input testCode is present, and is a row vector of 3 values, the function Lottery3 uses the code in testCode as the three winning numbers (the test must be three different integer numbers between 1 and 10), else three different numbers will be automatically generated by testCode The ouput should return the variable winnings and the three winning numbers in the row array winNumbers Hint: Make use of the internal function any Restriction: The function must use switch-case statements to determine the winning Example #1 winning Lottery3( [1,2,1],[1,2,3]) produces winning Example #2 Twinning,winNumbers] = Lottery3( [1,2,3]) produces winning winNumbers = 8 Trouble with lab

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_2

Step: 3

blur-text-image_3

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

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions