Advertisement
AnitaN

05.ConditionalStatementsHomework/03.CheckPlayCard

Mar 29th, 2014
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. //Problem 3.Check for a Play Card
  2. //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.
  3. //Write a program that enters a string and prints β€œyes” if it is a valid card sign or β€œno” otherwise.
  4.  
  5. using System;
  6.  
  7. class CheckPlayCard
  8. {
  9.     static void Main()
  10.     {
  11.         Console.Write("Please, enter card face: ");
  12.         string card = Console.ReadLine();
  13.         switch (card)
  14.         {
  15.             case "2":
  16.             case "3":
  17.             case "4":
  18.             case "5":
  19.             case "6":
  20.             case "7":
  21.             case "8":
  22.             case "9":
  23.             case "10":
  24.             case "J":
  25.             case "Q":
  26.             case "K":
  27.             case "A":
  28.                 Console.WriteLine("Valid card sign? Yes.");
  29.                 break;
  30.             default:
  31.                 Console.WriteLine("Valid card sign? No.");
  32.                 break;
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement