Advertisement
Guest User

Print Deck of Cards

a guest
Sep 27th, 2022
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.39 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.        
  6.                 Scanner scanner = new Scanner(System.in);
  7.         int input = scanner.nextInt();
  8.  
  9.         if (input > 1 && input < 15) {
  10.             for (int j = 2; j <= input; j++) {
  11.                 if (j < 11) {
  12.                     System.out.print(j + " of spades," + " " + j + " of clubs," + " " + j + " of hearts," + " " + j + " of diamonds");
  13.                     System.out.println("");
  14.                 }
  15.                 if (j > 10) {
  16.                     switch (j) {
  17.                         case 11:
  18.                             System.out.println("J of spades" + ", J of clubs" + ", J of hearts" + ", J of diamonds");
  19.                             break;
  20.                         case 12:
  21.                             System.out.println("Q of spades" + ", Q of clubs" + ", Q of hearts" + ", Q of diamonds");
  22.                             break;
  23.                         case 13:
  24.                             System.out.println("K of spades" + ", K of clubs" + ", K of hearts" + ", K of diamonds");
  25.                             break;
  26.                         case 14:
  27.                             System.out.println("A of spades" + ", A of clubs" + ", A of hearts" + ", A of diamonds");
  28.                             break;
  29.                     }
  30.                 }
  31.             }
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement