Question: Write a Java program that will read numbers between 1 and 14 and will output the appropriate symbol for a playing card of that rank
Write a Java program that will read numbers between 1 and 14 and will output the appropriate symbol for a playing card of that rank (use switch).For cards between 2 and 10 just print the rank, for 1 and 11 print "Ace", for 12 print "Jack", for 13 print "Queen", and for 14 print "King". Use a for loop to read and process n cards (input from user). Your program should also handle invalid input.
Sample output:
Playing cards program.
Give me
some numbers and
I will tell you the appropriate playing card.
=============================================
How many numbers?
20
ERROR!
Should be positive.
Reenter:
5
Enter card number:
23
ERROR!
Out of range (1
14).
Reenter:
11
You
have an Ac
e.
Enter card number:
14
You
have a King.
Enter card number:
2
You
have a two.
Enter card number:
13
You
have a Queen.
Enter card number:
1
You
have an Ace.
How would I do this in java?
Step by Step Solution
3.41 Rating (154 Votes )
There are 3 Steps involved in it
To solve the problem of creating a Java program that reads numbers between 1 and 14 and outputs the ... View full answer
Get step-by-step solutions from verified subject matter experts
