Question: Java. Write a class that defines an enumerated type named Rank with values ace, two, three, four, five, six, seven, eight, nine, ten, jack, queen,

Java. Write a class that defines an enumerated type named Rank with values ace, two, three, four, five, six, seven, eight, nine, ten, jack, queen, king. The main method should do the following: 1. Declare variables highCard, faceCard, card1, and card2 of type Rank. 2. Assign highCard to be an ace, faceCard to be a jack, queen or king (your choice), and card1 and card2 to be two different numbered cards (two through ten - your choice). 3. Print a line, using the highCard and faceCard objects, in the following format: A blackjack hand: ace and .... The faceCard variable should be printed instead of the dots. 4. Declare two variables card1 Val and card2Val of type int and assign them the face value of your card1 and card2 objects. Use your card1 and card2 variables and the ordinal method associated with enumerated types. Remember that the face value of two is 2, three is 3, and so on so you need to make a slight adjustment to the ordinal value of the enumerated type. 5. 5. Print two lines, using the card1 and card2 objects and the name method, as follows: A two card hand: (print card1 and card2) Hand value: (print the sum of the face values of the two cards

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To achieve what is required in the task lets go through it step by step Step 1 Define the Enumerated Type Well start by creating a class that defines ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!