## Assignment 16: Part 3 (`UsernameA16`)

Finish A16 by writing a dealer class (named `UsernameA16`) that allows a human user to ask for cards from a `Deck`.

### Steps

The idea of this program is that, when you go to a casino, you don't usually get to touch the deck yourself. Instead, you ask the dealer for a certain number of cards. If the dealer runs out of cards, he opens a new deck and the game continues.

Write a program that allows the user to draw as many cards as she'd like from a shuffled deck. Each card drawn should be displayed one per line. If she asks for 0 cards, your program should quit. (It's up to you whether you want to treat negative numbers as an error or an indication to quit.)

After each draw, your program should state how many cards remain in the deck.

If the last card in the deck is drawn, a new shuffled deck should be created so that drawing may continue until the total number of requested cards have been drawn. The program should indicate when a new deck has been "opened"/created.

### Sample Output

```This is your digital deck of playing cards!
A new deck has already been opened and shuffled for you.

[52 cards left in deck] How many cards to draw (0 to quit)? one
Error: Please enter a number >= 0.

[52 cards left in deck] How many cards to draw (0 to quit)? 1

5 of Hearts

[51 cards left in deck] How many cards to draw (0 to quit)? 3

Ace of Diamonds
7 of Diamonds
9 of Clubs

[48 cards left in deck] How many cards to draw (0 to quit)? 7

8 of Hearts
8 of Diamonds
5 of Diamonds
4 of Diamonds
Jack of Hearts
2 of Diamonds

[41 cards left in deck] How many cards to draw (0 to quit)? 45

King of Diamonds
3 of Diamonds
King of Clubs
3 of Clubs
Jack of Clubs
Queen of Hearts
6 of Diamonds
Queen of Diamonds
9 of Diamonds
10 of Diamonds
Jack of Diamonds
Ace of Clubs
Ace of Hearts
2 of Hearts
3 of Hearts
4 of Hearts
6 of Hearts
7 of Hearts
9 of Hearts
10 of Hearts
King of Hearts
5 of Clubs
7 of Clubs
2 of Clubs
4 of Clubs
6 of Clubs
8 of Clubs
10 of Clubs
Queen of Clubs
[--Opened a new deck--]
Ace of Clubs
8 of Clubs
8 of Diamonds
Ace of Diamonds

[48 cards left in deck] How many cards to draw (0 to quit)? 0
```

### What to Submit

Paste your other two classes into your `UsernameA16.java` file. Remember that you will need to remove the `public` modifier when from those two classes when you do this. Also, remember to be careful not to accidentally put one class within another. Your file should then be structured like this:

```public class UsernameA16 {
//... your main method in here ...
}

class Deck {
//... contents of the Deck class ...
}

class PlayingCard {
//... contents of PlayingCard class ...
}
```

You may want to try deleting your .class files and compiling and running your UsernameA16.java one last time before you submit.

Then, upload your complete `UsernameA16.java` file to Tamarin.

1 - Compiles + Coding Standards
Your program compiles successfully (no errors). Your code follows Java coding standards.
0.5 - Encapsulation
All instance variables are private.
2.5 - `PlayingCard`
Contains requested public static constants for suits and Joker (0.5). Constructor (0.5), two `get` methods (0.5), and `toString()` (1.0) are named correctly and work as specified in the provide /** javadocs */.
3.5 - `Deck`
Contains the 2 constructors (1.5), `draw()` (0.5), `getSize()` (0.5) and `shuffle()` (1.0) methods. All perform correctly as specified in the provide /** javadocs */.
2.5 - `UsernameA16`
Always draws the specified number of cards from a shuffled deck, displaying each 1 per line (1.0). Indicates when a new deck has been opened (0.5). Quits on 0 and catches bad input (0.5). Indicates how many cards remain in the deck after each draw (0.5).

### FAQs

So, although a new Deck can be sorted, we're only creating shuffled decks here?
That is correct. Being able to create a sorted deck is still handy for testing purposes though--it's easier to see if all the 52 cards are really there.
When the Deck runs out of cards, do we reset it somehow or create a new Deck object?
Create a new Deck object.