Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. /**
  2. *
  3. * Jared Bergan Feb 13, 2017 Card.java This program will
  4. *
  5. */
  6. public class Card {
  7. private int value;
  8. private char suit;
  9.  
  10. public Card() {
  11. value = 0;
  12. suit = '\0';
  13. }
  14.  
  15. public Card(int v, char s) {
  16. value = v;
  17. suit = s;
  18. }
  19.  
  20. public void setValue(int v)
  21. {
  22. value = v;
  23. }
  24.  
  25. public void setSuit(char s)
  26. {
  27. suit = s;
  28. }
  29.  
  30. public int getValue()
  31. {
  32. return value;
  33. }
  34.  
  35. public char getSuit()
  36. {
  37. return suit;
  38. }
  39.  
  40. public String toString()
  41. {
  42. if(this.getValue()==1)
  43. return ("a"+suit).toUpperCase();
  44. else if(this.getValue()==11)
  45. return ("j"+suit).toUpperCase();
  46. else if(this.getValue()==12)
  47. return ("q"+suit).toUpperCase();
  48. else if(this.getValue()==13)
  49. return ("k"+suit).toUpperCase();
  50. else
  51. return (""+this.getValue()+this.getSuit()).toUpperCase();
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement