Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. import javax.smartcardio.Card;
  2.  
  3. public class Game {
  4.  
  5. private int rank;
  6. private int suit;
  7.  
  8.  
  9. public Card(int rank, int suit) {
  10. this.rank = rank;
  11. this.suit = suit;
  12. }
  13.  
  14. public String toString() {
  15. String[] ranks = {null, "Ace", "2", "3", "4", "5", "6",
  16. "7", "8", "9", "10", "Jack", "Queen", "King"};
  17.  
  18. String[] suits = {"Clubs", "Diamonds", "Hearts", "Spades"};
  19. String s = ranks[this.rank] + " of " + suits[this.suit];
  20. return s;
  21. }
  22.  
  23.  
  24.  
  25.  
  26. public static void main(String[] args) {
  27. Card card = new Card(11,1);
  28. System.out.println(card);
  29.  
  30. }
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement