Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Print Deck of Cards {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String input = scanner.nextLine();
- int num;
- switch (input) {
- case "J":
- num = 11;
- break;
- case "Q":
- num = 12;
- break;
- case "K":
- num = 13;
- break;
- case "A":
- num = 14;
- break;
- default:
- num = Integer.parseInt(input);
- break;
- }
- for (int i = 2; i <= num; i++) {
- switch (i){
- case 11:
- System.out.println("J of spades, J of clubs, J of hearts, J of diamonds");
- break;
- case 12:
- System.out.println("Q of spades, Q of clubs, Q of hearts, Q of diamonds");
- break;
- case 13:
- System.out.println("K of spades, K of clubs, K of hearts, K of diamonds");
- break;
- case 14:
- System.out.println("A of spades, A of clubs, A of hearts, A of diamonds");
- break;
- default:
- System.out.printf("%d of spades, %d of clubs, %d of hearts, %d of diamonds%n", i, i, i, i);
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement