Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

-Write a program that takes user input describing a playing card in the followin

ID: 3678363 • Letter: #

Question

-Write a program that takes user input describing a playing card in the following shorthand notation:

A Ace

2 ... 10 - Card Value 2 through 10 respectively

J Jack

Q Queen

D Diamonds

H Hearts

S Spades

C Clubs

-Your program should print the full description of the card.

For example, Enter the card notation: QS

Queen of Spades

-Run it once with manual input from the user. Once you get that working, add a user input that states how many cards to deal and use a loop to display that many random cards.

Explanation / Answer

}

//CardDescription.java

public class Card { private String denom; private String suite; private String String1; private String String2; public Card(String s1) { denom = s1.substring(0, 1); suite = s1.substring(1); } public String getDescription() { if (denom.equalsIgnoreCase("K")) { String1 = "King"; } else if (denom.equalsIgnoreCase("Q")) { String1 = "Queen"; } else if (denom.equalsIgnoreCase("J")) { String1 = "Jack"; } else if (denom.equals("10")) { String1 = "Ten"; } else if (denom.equals("9")) { String1 = "Nine"; } else if (denom.equals("8")) { String1 = "Eight"; } else if (denom.equals("7")) { String1 = "Seven"; } else if (denom.equals("6")) { String1 = "Six"; } else if (denom.equals("5")) { String1 = "Five"; } else if (denom.equals("4")) { String1 = "Four"; } else if (denom.equals("3")) { String1 = "Three"; } else if (denom.equals("2")) { String1 = "Two"; } else if (denom.equalsIgnoreCase("A")) { String1 = "Ace"; } if (suite.equalsIgnoreCase("D")) { String2 = "Diamonds"; } else if (suite.equalsIgnoreCase("H")) { String2 = "Hearts"; } else if (suite.equalsIgnoreCase("C")) { String2 = "Clubs"; } else if (suite.equalsIgnoreCase("S")) { String2 = "Spades"; } return String1 + " of " + String2; }

}

//CardDescription.java

import java.util.*; public class CardDescription { public static void main(String[] args) { Card c1 = new Card("KS"); System.out.println("Your card is " + c1.getDescription()); } }