Question: Chapter 1 6 Card Objects Design and implement an object - oriented program for displaying a deck of cards. Each card will have a value

Chapter 16 Card Objects
Design and implement an object-oriented program for displaying a deck of cards. Each card will have a value ranging in order from 1 for an ace, 2 for a two, and so on up to and including 11 for a jack, 12 for a queen, and 13 for the king.
The focus of the exercise is to create three classes that represent a card, deck, and hand using composition.
Console
```
Cards - Tester
DECK
Ace of Clubs
2
3
4
5 ranks =[Ace,2,3,4,5,6,7,8,9,10, Jack, Queen, King]
suits =[Clubs, Diamonds, Hearts, Spades]
The Hand class will hold a list of cards. It will have the following methods.
A constructor method, with no parameter (except for self), will create a private 'cards'
attribute as a list.
An 'addCard' method that takes a card object parameter which will add the card object to
the cards attribute.
A 'playCard' method that takes a named index parameter. The default index value is zero.
The method will remove the card at the index value of the cards attribute and return the
card object.
A 'count' method that returns the length of the cards attribute.
A 'totalPoints' method that returns the total of the values of all cards in the hand.
A _() iter_(_()) and next method so that a Hand object can be used in a loop.
The main method, in a module separate from the objects module, will do the following.
Create a deck object
Print all cards in the deck as a string
Shuffle the deck
Print the size of the deck
Deal a hand with five cards
Print the cards of the hand
Print the total value of the hand
Print the number of cards in the hand, and
Print the number of cards in the deck
Chapter 1 6 Card Objects Design and implement an

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 Programming Questions!