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

Need help. Please see pictures. Thank you We will build a Deck class which will

ID: 3784183 • Letter: N

Question

Need help. Please see pictures.
Thank you We will build a Deck class which will let us build a deck of cards (52 Cards) consisting of 4 suits Clubs, Diamonds, Hearts and Each suit will have 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 and 14 SPADE whereby upon printing a card, the 11 will be printed as Jack of the 12 will be printed as Queen of.., the 12 will be printed as King of and the 14 will be printed as Ace of They will store this Deck of Cards inside of an array. They will also add other methods that may need now or when they will be using this in the main program later. I will add more to this later to eventually let them develop the card game.

Explanation / Answer

You want to build a class which will represent a Card.

Card -> Array of Cards = Deck

class Card:
   @ val: value of card 2-14. type int
   @ set: value -> clubs, heart, diamond, spade. type string
   def __init__ (self, val, set):
       // also include checks for values.
       //{assert values are proper}
       self.val= val
       self.set= set
  
   def printCard(self):
       x= ""
       if self.val in range(2,11):
           return str(self.val) + "of "+ self.set
       else:
           if self.val== 11:
               x="Jack"
           elif self.val==12:
               x="Queen"
           elif self.val==13:
               x="King"
           else:
               x= "Ace"
          
           return self.val + "of "+ self.set

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