Documente Academic
Documente Profesional
Documente Cultură
Questions
Exercises
1. Write a class whose instances represent a single playing card from a deck of cards.
Playing cards have two distinguishing properties: rank and suit. Be sure to keep your
solution as you will be asked to rewrite it in Enum Types.
Hint: You can use the assert statement to check your assignments. You write:
assert (boolean expression to test);
If the boolean expression is false, you will get an error message. For example,
assert toString(ACE) == "Ace";
should return true, so there will be no error message.
If you use the assert statement, you must run your program with the ea flag:
3. Write a small program to test your deck and card classes. The program can be as
simple as creating a deck of cards and displaying its cards.
Questions and Exercises: Objects
Questions
Exercises
2. Consider the Card, Deck, and DisplayDeck classes you wrote in Questions and
Exercises: Classes . What Object methods should each of these classes override?
Exercises
1. Write the implementations for the methods that you answered in question 2.