title: In the default constructor initialize attributes
body: <p>I'm kind of stuck while doing my homework and I'm having a hard time to understand what to do next. So my instructions are as follows:</p>
  <blockquote>
  <ol>
  <li><p>Create a new class called <code>Card</code>. The Constructors from superclass check box will create a constructor stub in the code.</p>
  </li>
  <li><p>Create an Enumerated Type in a new source file called <code>Suit</code> with the values <code>NONE</code>, <code>CLUBS</code>, <code>HEARTS</code>, <code>SPADES</code>, <code>DIAMONDS</code>.</p>
  </li>
  <li><p>Create an Enumerated Type in a new source file in the same package as the <code>Card</code> class, called <code>Rank</code> with the values <code>JOKER</code>, <code>TWO</code>, <code>THREE</code>, <code>FOUR</code>, <code>FIVE</code>, <code>SIX</code>, <code>SEVEN</code>, <code>EIGHT</code>, <code>NINE</code>, <code>TEN</code>, <code>JACK</code>, <code>QUEEN</code>, <code>KING</code>, <code>ACE</code>.</p>
  </li>
  <li><p>In the class <code>Card</code>,<br />
  A) Create a class attribute (field) called <code>rank</code> of type <code>Rank</code>.<br />
  B) Create a class attribute (field) called <code>suit</code> of type <code>Suit</code>.<br />
  C) Create getters and setters for these fields. Make the setters private, since we only want the constructor to set the card <code>Suit</code> and <code>Rank</code> (we would not want a programmer or user to set more than one <code>ACE</code> of <code>CLUBS</code> for instance).</p>
  </li>
  <li><p>Create a constructor that accepts a <code>Suit</code> and a <code>Rank</code> and use those values to set the attributes.</p>
  </li>
  <li><p>In the default constructor, initialize the <code>suit</code> and <code>rank</code> attributes. Use the this constructor to call the constructor created in the previous step and initialize the rank and suit with a value of your choice (for example: <code>Rank.ACE</code>, <code>Suit.CLUBS</code>).</p>
  </li>
  <li><p>In the main method of the class, construct a default <code>Card</code> to demonstrate the default constructor initialization.</p>
  </li>
  <li><p>Also construct a few additional cards using the <code>Suit</code> and <code>Rank</code> constructor. Use local variables to hold the objects.</p>
  </li>
  <li><p>Using the <code>toString()</code> method from Enumerated Types, print the <code>Suit</code> and <code>Rank</code> of each <code>Card</code> created.</p>
  </li>
  <li><p>Create a <code>Deck</code> class that contains a field that is an array of fifty four cards (Containment).</p>
  </li>
  <li><p>Create a constructor on the <code>Deck</code> class that initializes the array of cards with the standard deck and two jokers, using <code>for</code> loops that iterate over the <code>Suit</code> and <code>Rank</code> values and set the array members with the appropriate <code>Card</code> constructor. Remember that the two Jokers only exist as <code>NONE</code> suits and only the Jokers use the <code>NONE</code> suit. There are many possible solutions for creating only two jokers. I used an iterator, left them out of the loop and added them in the beginning, individually. Use an <code>if</code> statement to exclude the jokers within a <code>for each</code> loop and add them before or after.</p>
  </li>
  <li><p>Create a <code>toString()</code> method in the <code>Deck</code> class, using another <code>for</code> loop to print all the <code>Card</code>s in the array by calling the <code>toString()</code> method on each card. This method “asks” the <code>Card</code> to print its rank and suit by only calling <code>toString()</code> on the <code>Card</code> object. There should be no reference to <code>Rank</code> or <code>Suit</code> anywhere in this method. Let <code>Card</code>'s <code>toString()</code> method do the work (Delegation).</p>
  </li>
  <li><p>Create a <code>main</code> method in the <code>Deck</code> class that creates a <code>Deck</code>. Then print the deck using <code>System.out.println()</code>. This will call <code>Deck</code>'s <code>toString()</code> method, which will call <code>toString()</code> on each <code>Card</code>, printing the entire deck.</p>
  </li>
  </ol>
  </blockquote>
  <pre><code>    public class Card {
  
      //Default Constructor
      Card (){
      }
  
     //Create a class attribute (field) called rank of type Rank.
     Rank rank;
     //Create a class attribute (field) called rank of type Suit
     Suit suit;
     //Create an Enumerated Type in a new source file called Suit
     public enum Suit{
     NONE, CLUBS, HEARTS, SPADES, DIAMONDS
     }
     //Create an Enumerated Type in a new source file called Rank
     public enum Rank{
     JOKER, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK,QUEEN,KING, ACE        
     }
  
    //Getters &amp; Setters for Rank/Suit
   //Make the setters private, since we only want the constructor to set the   card Suit and Rank
   public Rank getRank() {
   return rank;
   }
   private void setRank(Rank rank) { 
   this.rank = rank;
   }
   public Suit getSuit() {
   return suit;
   }
   private void setSuit(Suit suit) {
   this.suit = suit;
   }
  
  //Create a constructor that accepts a Suit and a Rank and use those values   to set the attributes.
  Card ( Rank Rank, Suit Suit){ 
  suit = Suit;
  rank = Rank;
  }
  
  
  
  
  
  
      public static void main(String[] args) {
  
      }
  
  
  
      }
  </code></pre>