Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a Ruby program that includes two classes Deck and Card. See attached docum

ID: 3593029 • Letter: W

Question

Write a Ruby program that includes two classes Deck and Card. See attached document. Store your program in a file called myDeck.rb (40 points) Sample Input/Output ruby.exe mydeck.rb 15 o Ac, 5s, 7d, Qc, 7h, 8c, Jh, 9d, Qs, 5c, Ts, Jd, 7s, 3d, 6c o Error: Argument number must be a positive number o Output all cards ruby.exe mydeck.rb -1 ruby.exe mydeck.rb 60 Must use the below outline. Thank you in advance! # Class Card represents a playing card class Card # Assign a new card a rank and a suit def initialize(rankVal, suit) End # Returns a readable string representation of a card (see sample output) def tostring end end # Class Deck represents a deck of 52 playing cards. Rank 2 through Ace; Suits # spades (s), hearts (h), diamonds (d), clubs (c) class Deck

Explanation / Answer

require 'rubycards' include RubyCards hand = Hand.new deck = Deck.new deck.shuffle! hand.draw(deck, 5) puts hand require 'rubycards' include RubyCards hand = Hand.new deck = Deck.new(number_decks: 2, exclude_rank: [2, 'Jack']) deck.shuffle! hand.draw(deck, 10) puts hand

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote