Question: For python! Define the card class Card.py - Defines a Card class. For simplicity, this class will assume all Cards have a suit and a


For python! Define the card class
Card.py - Defines a Card class. For simplicity, this class will assume all Cards have a suit and a rank Card.py The Card.py file will contain the definition of a Card class. The Card class will hold information about the cards (suit and rank), and for simplicity, it will also double as a node in our PlayerHand BST. We will define the Card attributes as follows: suit - string value that distinguishes what suit that card is: C (club), D (diamond), H (heart), or s (spade) rank - string value to distinguish the rank of the card (in ascending value): A (ace), 2, 3, 4, 5, 6, 7, 8, 9, 10, 3 (Jack), 1 (Queen), K (King). Assume there is no Joker parent - a reference to the parent node of a card in the BST, None if it has no parent (it is the root) left - a reference to the left child of a card in the BST, None if it has no left child right - a reference to the right child of a card in the BST, None if it has no right child count - an integer representing the amount of times this card appears in the BST. 1 by default, but it can be greater since your implementation should support duplicate cards . . You will write a constructor that allows the user to construct a Card object by passing in values for the suit and rank. Your constructor should also create the count attribute and initialize it to 1, as well as create the parent, left, and right attributes initialized to None. __init__(self, suit, rank) Your Card class definition should also support the following "getter" and "setter" methods: . getSuit(self) setSuit(self, suit) getRank(self) setRank (self, rank) getCount(self) setCount(self, count) . . . . setCount(self, count) getParent(self) setParent(self, parent) getLeft(self) setLeft(self, left) getRight(self) setRight(self, right) _str_(self) - the overloaded to-string operator. For example, it should return the string "S A | 1 " if the Card is an Ace of Spades and has no duplicates . . . Lastly, your Card class can overload the >,
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
