Professional Documents
Culture Documents
1
studentName = null;
4. How does a program destroy an object that it creates?
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:
If the boolean expression is false, you will get an error message. For example,
If you use the assert statement, you must run your program with the ea flag:
2. Write a class whose instances represent a full deck of cards. You should also
keep this solution.
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.
4. Fix the program called SomethingIsWrong shown in Question 1.
5. Given the following class, called NumberHolder, write some code that creates
an instance of the class, initializes its two member variables, and then displays
the value of each member variable.