Question: Write a MATLAB program that provides the following functions with respect to a deck of cards: (Note, cards should be represented using the numbers 1-13

Write a MATLAB program that provides the following functions with respect to a deck of cards: (Note, cards should be represented using the numbers 1-13 and the letters 'S', 'H', 'D', and 'C' (for spades, hearts, diamonds, clubs.)

create_deck() => no inputs, returns a deck in initial order

shuffle_deck() => takes a deck as input, and returns a shuffled deck

display_deck() => takes in a deck and displays each card in the deck in the order they exist. Eg: AC, 3D, 10H, KH, ... Where A => Ace (number is 1), K => King (number is 13), Q => Queen (number is 12), and J => Jack (number is 11).

verify_deck() => takes in a deck and verifies that the deck contains 13 cards of each suit. Returns true if this the case, and false if the deck is not correct.

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!