I am writing he shoe, deck and card class for blackjack. I am in a slum trying to
test the code. i have written a testclass but I am not getting any ouput.I was wondering if you could look at my classes and tell me what I am doing wrong.
public class Card {
public final static int SPADES = 0,
HEARTS = 1,
DIAMONDS = 2,
CLUBS = 3;
public final static int ACE = 1,
JACK = 11,
QUEEN = 12,
KING = 13;
private final int suit;
private final int value;
public Card(int theValue, int theSuit) {
value = theValue;
suit = theSuit;
}
public int getSuit() {
return suit;
}
public int getValue() {
return value;
}
public
String SuittoString() {
switch ( suit ) {
case SPADES: return "Spades";
case HEARTS: return "Hearts";
case DIAMONDS: return "Diamonds";
case CLUBS: return "Clubs";
default: return "Invalid?";
}
}
public String getSValue() {
// If the card's value is invalid, "Invalid?" is returned.
switch ( value ) {
case 1: return "Ace";
case 2: return "2";
case 3: return "3";
case 4: return "4";
case 5: return "5";
case 6: return "6";
case 7: return "7";
case 8: return "8";
case 9: return "9";
case 10: return "10";
case 11: return "Jack";
case 12: return "Queen";
case 13: return "King";
default: return "Invalid?";
}
}
public String toString() {
// Return a String representation of this card, such as
// "10 of Hearts" or "Queen of Spades".
return getSValue() + " of " + SuittoString();
}
} // end class Card
Shoe class
public class CardTest {
//public static void main(String[] args) {
// A card dealt from the deck.
CardTest deck = new CardTest(); // Create the deck.
deck.shuffle();
deck.drawCard();
System.println("Deck contains:");
for ( int i = 0; i <= deck; i++ ) {
// Get a card from the deck, print it out,
card = Card.getValue();
System.println(" " + card);
}
}
}
[CODE]
If you could give me some insight on what i am doing wrong I would be truly grateful.