Lab 6: A Deck of Cards
Due by the end of class
Your mission is to print out all 52 of the cards in a standard deck of cards, in order.
A deck of cards is made up of the following four suits:
- Spades
- Hearts
- Diamonds
- Clubs
Each suit contains the following 13 ranks:
- Ace
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- Jack
- Queen
- King
Specification
Create a project called Lab6
. Add a class called Cards
. Your program has no input, just the following output.
Ace of Spades 2 of Spades 3 of Spades 4 of Spades 5 of Spades 6 of Spades 7 of Spades 8 of Spades 9 of Spades 10 of Spades Jack of Spades Queen of Spades King of Spades Ace of Hearts 2 of Hearts 3 of Hearts 4 of Hearts 5 of Hearts 6 of Hearts 7 of Hearts 8 of Hearts 9 of Hearts 10 of Hearts Jack of Hearts Queen of Hearts King of Hearts Ace of Diamonds 2 of Diamonds 3 of Diamonds 4 of Diamonds 5 of Diamonds 6 of Diamonds 7 of Diamonds 8 of Diamonds 9 of Diamonds 10 of Diamonds Jack of Diamonds Queen of Diamonds King of Diamonds Ace of Clubs 2 of Clubs 3 of Clubs 4 of Clubs 5 of Clubs 6 of Clubs 7 of Clubs 8 of Clubs 9 of Clubs 10 of Clubs Jack of Clubs Queen of Clubs King of Clubs
You must print all the cards out, in the order of suits, with each rank ordered within each suit. You must use nested loops to accomplish this task. Hint: Loop through suits and loops through ranks. Note that, for ranks 2 through 10, you can simply print out the value of the ranks. You can handle Ace, Jack, Queen, and King as special cases.
Although you can write a program which simply prints out the above material that you have copied and pasted in, you will lose the majority of points for doing so. You must use nested loops.
Turn In
Turn in your code by uploading Cards.java
from the Lab6\src
folder wherever you created your project to Blackboard. Do not upload the entire project. I only want the Cards.java
file.
All work must be done individually. Never look at someone else's code. Please refer to the course policies if you have any questions about academic integrity. If you have trouble with the assignment, I am always available for assistance.