Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class CheckForPlayCard {
- public static void main(String[] args) {
- /*
- Classical play cards use the following signs to designate the card face: 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K and A.
- Write a program that enters a string and prints “yes” if it is a valid card sign or “no” otherwise.
- */
- Scanner scan =new Scanner(System.in);
- String playCard =scan.nextLine();
- switch (playCard) {
- case "2":
- case "3":
- case "4":
- case "5":
- case "6":
- case "7":
- case "8":
- case "9":
- case "10":
- case "J":
- case "Q":
- case "K":
- case "A":
- System.out.println("yes");
- break;
- default:
- System.out.println("no");
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement