Advertisement
Guest User

Untitled

a guest
Feb 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. /**
  2. * This is a class that tests the Deck class.
  3. */
  4. public class DeckTester {
  5.  
  6. /**
  7. * The main method in this class checks the Deck operations for consistency.
  8. * @param args is not used.
  9. */
  10. public static void main(String[] args) {
  11. String[] ranks = {"jack", "queen", "king"};
  12. String[] suits = {"blue", "red"};
  13. int[] pointValues = {11, 12, 13};
  14. Deck d = new Deck(ranks, suits, pointValues);
  15.  
  16. System.out.println("**** Original Deck Methods ****");
  17. System.out.println(" toString:\n" + d.toString());
  18. System.out.println(" isEmpty: " + d.isEmpty());
  19. System.out.println(" size: " + d.size());
  20. System.out.println();
  21. System.out.println();
  22.  
  23. System.out.println("**** Deal a Card ****");
  24. System.out.println(" deal: " + d.deal());
  25. System.out.println();
  26. System.out.println();
  27.  
  28. System.out.println("**** Deck Methods After 1 Card Dealt ****");
  29. System.out.println(" toString:\n" + d.toString());
  30. System.out.println(" isEmpty: " + d.isEmpty());
  31. System.out.println(" size: " + d.size());
  32. System.out.println();
  33. System.out.println();
  34.  
  35. System.out.println("**** Deal Remaining 5 Cards ****");
  36. for (int i = 0; i < 5; i++) {
  37. System.out.println(" deal: " + d.deal());
  38. }
  39. System.out.println();
  40. System.out.println();
  41.  
  42. System.out.println("**** Deck Methods After All Cards Dealt ****");
  43. System.out.println(" toString:\n" + d.toString());
  44. System.out.println(" isEmpty: " + d.isEmpty());
  45. System.out.println(" size: " + d.size());
  46. System.out.println();
  47. System.out.println();
  48.  
  49. System.out.println("**** Deal a Card From Empty Deck ****");
  50. System.out.println(" deal: " + d.deal());
  51. System.out.println();
  52. System.out.println();
  53.  
  54. /* *** TO BE COMPLETED IN ACTIVITY 4 *** */
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement