skilletwaffles

CardTester

Jan 7th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. /**
  2. * This is a class that tests the Card class.
  3. */
  4. public class CardTester {
  5.  
  6. /**
  7. * The main method in this class checks the Card operations for consistency.
  8. * @param args is not used.
  9. */
  10. public static void main(String[] args) {
  11. Card aceHeart = new Card("Ace", "Hearts", 1);
  12. Card aceHeart2 = new Card("Ace", "Hearts", 1);
  13. Card queenSpade = new Card("Queen", "Spades", 12);
  14.  
  15. //testing to string
  16. System.out.println(aceHeart.toString());
  17. System.out.println(queenSpade.toString());
  18. System.out.println(aceHeart2.toString());
  19.  
  20. System.out.println("Info on first card: ");
  21.  
  22. //testing accessors
  23. System.out.println(aceHeart.rank() + " " + aceHeart.suit() + " " + aceHeart.pointValue());
  24.  
  25. System.out.println("");
  26.  
  27. //testing matches
  28. if(aceHeart.matches(aceHeart2) == true)
  29. System.out.println("These cards are the same");
  30. else
  31. System.out.println("These cards are not the same");
  32. if(aceHeart.matches(queenSpade) == true)
  33. System.out.println("These cards are the same");
  34. else
  35. System.out.println("These cards are not the same");
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment