Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Project 2
- * @author Gerald Cohen, Ph.D.
- */
- public final class Card {
- private static final String[] suits = {"C", "D", "H", "S"};
- private static final String[] names = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
- private final int cardNumber;
- private String suit, name;
- public Card(int name, int suit, int cardNumber) {
- this.cardNumber = cardNumber;
- this.suit = suits[suit - 1];
- this.name = names[name - 1];
- }
- /**
- * Return the numerical value of the card
- * @return face value 1 to 13
- */
- public int getFaceValue() {
- return cardNumber;
- // TODO - return the face value of a card
- }
- public String toString() {
- // TODO - complete so that the string representation of a card is correct
- return name + " of " + suit;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement