Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * This is a class that tests the Card class.
- */
- public class CardTester {
- /**
- * The main method in this class checks the Card operations for consistency.
- * @param args is not used.
- */
- public static void main(String[] args) {
- Card aceHeart = new Card("Ace", "Hearts", 1);
- Card aceHeart2 = new Card("Ace", "Hearts", 1);
- Card queenSpade = new Card("Queen", "Spades", 12);
- //testing to string
- System.out.println(aceHeart.toString());
- System.out.println(queenSpade.toString());
- System.out.println(aceHeart2.toString());
- System.out.println("Info on first card: ");
- //testing accessors
- System.out.println(aceHeart.rank() + " " + aceHeart.suit() + " " + aceHeart.pointValue());
- System.out.println("");
- //testing matches
- if(aceHeart.matches(aceHeart2) == true)
- System.out.println("These cards are the same");
- else
- System.out.println("These cards are not the same");
- if(aceHeart.matches(queenSpade) == true)
- System.out.println("These cards are the same");
- else
- System.out.println("These cards are not the same");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment