Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is card.java
- package cardgame;
- public class Card {
- public static final String [] SUIT_STR =
- {"Diamond", "Club", "Heart", "Spade"};
- private int suit; // 0 Diamond, 1 Clubs, 2 Hearts, 3 Spades
- private int number; // 1-10, 11 Jack, 12 Queen, 3 King
- public Card(int suit, int number){
- this.suit = suit;
- this.number = number;
- }
- public String getDetail() {
- if (number <= 10)
- return(number + " of " + SUIT_STR[suit]);
- else if (number == 11)
- return("Jack of " + SUIT_STR[suit]);
- else if (number == 12)
- return("Queen of " + SUIT_STR[suit]);
- else
- return("King of " + SUIT_STR[suit]);
- }
- }
Add Comment
Please, Sign In to add comment