Compare the values of the cards and output a message


In this assignment you will be using If statements and random numbers.

The random numbers will be simulating playing cards. The face values of the cards are as follows

Number & Value Card Face
2-10 number = face
11 jack
12 queen
13 king
14 Ace

You will be coding a two player game.

You will be generating the value of cards using the random number generator (see week 2 notes) where each card will have a value between 2 and 14.

Task 1:
- Input the name of the player
- For the first player, generate 3 random cards. Print all these three values for testing purposes
- Compare the values of the cards and output a message stating the face of the highest card (e.g. if the highest number generated is 11, output a suitable message such "Your highest card is a jack")

Task 2:

Do the same for the second player.

Task 3:
Compare the highest card for each player in all 3 rounds and output a message saying who has the highest card (e.g. Player2 has the highest card if Player1=10, Player 2 =12 (Queen) or whether the values have drawn (i.e. both the players have the same value card).

Task 4:
Total the face values of the cards for each player after three rounds and display the total face value for each player, stating which player has the highest overall value.

Task 5:

When generating each card, generate a number between 15 and 18 to represent the suit e.g.

Number suit
11 clubs
12 diamonds
13 hearts
14 spades

Display the suit along with the card for e.g. 7 of clubs

Solution Preview :

Prepared by a verified Expert
Engineering Mathematics: Compare the values of the cards and output a message
Reference No:- TGS02583178

Now Priced at $30 (50% Discount)

Recommended (96%)

Rated (4.8/5)