Write a MATLAB program that provides the following functions with respect to a d
ID: 3824459 • Letter: W
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 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.
Explanation / Answer
import java.util.Stack; import java.util.Random; import java.util.Collections; public class Blackjack { public static String capitalizeFully(String str) { String s = new String(); for (int i = 1; i 13) { throw new IllegalArgumentException("Invalid card value (must be between 1 and 13)."); } this.value = value; } public Value(String value) throws IllegalArgumentException { int i = 0; String val = capitalizeFully(value); while (iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.