Guest User

Untitled

a guest
Oct 3rd, 2021
57
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class PrintDeckOfCards {
  2. public static void main(String[] args) {
  3.  
  4. String sign = "";
  5. String suit = "";
  6.  
  7. for (int cardNum = 2; cardNum <= 14; cardNum++) {
  8. switch (cardNum) {
  9. case 11: sign = "J"; break;
  10. case 12: sign = "Q"; break;
  11. case 13: sign = "K"; break;
  12. case 14: sign = "A"; break;
  13. default: sign = String.valueOf(cardNum);
  14. }
  15. for (int cardSuit = 1; cardSuit <= 4; cardSuit++) {
  16. switch (cardSuit) {
  17. case 1: suit = "spades, "; break;
  18. case 2: suit = "clubs, "; break;
  19. case 3: suit = "hearts, "; break;
  20. case 4: suit = "diamonds"; break;
  21. }
  22. System.out.print(sign + " of " + suit);
  23. }
  24. System.out.println();
  25. }
  26. }
  27. }
RAW Paste Data