Question: How to do this in Matlab? Problem 2a: In this problem, you are going to write a simple dice game. The winning numbers of the

How to do this in Matlab? Problem 2a: In this problem, youHow to do this in Matlab?

Problem 2a: In this problem, you are going to write a simple dice game. The winning numbers of the dice consist of three random integer numbers between 1 and 6 (see documentations of randi0 and randpermO functions). Your code should ask the player to input/guess 3 integer numbers between 1 and 6 (use inputdlg0 function as described in Problem la). When the user enters all the numbers, your code should compare the user's numbers with the winning numbers and display a message that shows how many of them match and much the user has earned. You must use if-else statements to check and display the messages. You can use logical indexing with sum function to find how many numbers match. The player doesn't have to guess the order of numbers that are randomly generated and numbers can be repeated. If they match all 3 numbers, they win $1000. If they match any 2 numbers, they win $10. If they match only 1 number, they win $1 If they don't match any number, they win nothing. The messages that display in the command window should look similar to the examples below:

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!