Need this completed 100% percent as soon as possible.
You are to write a program to help a person to play the card game called Blackjack or 21. The game is played with several standard decks of playing cards without the jokers. Each card dealt contributes points to your total as follows: cards 2-10 contribute their value to the total; the cards of Jack, Queen and King count for 10 points and an Ace can count for 1 or 11 points. The object of the game is to try to get as close to 21 points without exceeding 21 points and to try and beat the points in the dealer’s hand. The dealer must continue drawing cards for the dealer’s hand if the point total is less than 17 and must stop drawing cards for their hand if their point total is at least 17. If your total is over 21 you automatically lose. If your total is 21 or less and is greater than the dealer’s total you win. If the dealer draws more than 21 points and your point total is 21 or less you win. If your total is less than or equal to 21 and is equal to the dealer’s total you tie. (For more information about the game see [login to view URL] )
You can assume that only integer inputs will be provided. However an error message is to be displayed if an invalid integer value is entered and input is to be prompted for and re-input until valid.
Testing Dialogues: Your program MUST prompt for inputs and produce outputs EXACTLY as shown below.
Test dialogue 1 for a maximum mark of 60%:
· Process 2 cards only
· Code and correctly use following functions:
- int validateCard() to prompt for, validate and return card number (Ace:1, 2:2, 3:3, …, 10:10, Jack:11, Queen:12, King: 13)
- int value(int card) passed a card number and returns the value of that card (Ace: 1 point, 2:2, 3:3, …, 10:10, 11: 10, 12:10, 13:10 points)
- void endResult(int highestTotal) passed the highest valid point total of your hand (i.e. highest point total that is less than or equal to 21), prompts for and validates dealer’s total (must be greater than 16 and less than 27) and displays whether you have won, tied or lost
Enter card (1-13): 11
Enter card (1-13): 10
Total(s): 20
Enter dealer's total: 17
YOU WON!!
Another game (1:Yes/0:No): 1
Enter card (1-13): 1
Enter card (1-13): 12
Total(s): 11, 21
Enter dealer's total: 21
TIE
Another game (1:Yes/0:No): 1
Enter card (1-13): 2
Enter card (1-13): 1
Total(s): 3, 13
Enter dealer's total: 22
YOU WON!!
Another game (1:Yes/0:No): -1
Error! Enter 1 for yes or 0 for no.
Another game (1:Yes/0:No): 2
Error! Enter 1 for yes or 0 for no.
Another game (1:Yes/0:No): 1
Enter card (1-13): 0
Error card must be between 1 and 13!
Enter card: 14
Error card must be between 1 and 13!
Enter card: 8
Enter card (1-13): 1
Total(s): 9, 19
Enter dealer's total: 16
Dealer total must be between 17 and 26!
Enter dealer's total: 27
Dealer total must be between 17 and 26!
Enter dealer's total: 20
YOU LOST!!
Another game (1:Yes/0:No): -1
Error! Enter 1 for yes or 0 for no.
Another game (1:Yes/0:No): 2
Error! Enter 1 for yes or 0 for no.
Another game (1:Yes/0:No): 0
Test dialogue 2 for a maximum mark of 80%:
· Process up to maximum of 3 cards
· Code and correctly use following functions:
- Functions from previous dialogue plus
- int anotherCard() to prompt for, validate and return 0 (no more cards wanted) or 1 (another card wanted)
- void totals(int total, int numAces, int *pLost, int *pHighestTotal) where total is the total point of cards in hand using only 1 point for each Ace, numAces is the number of Aces in hand, *pLost (value of 1 represents if point total exceeds 21, else value of 0) and *pHighestTotal represents highest point total that is less than 22
- change endResult to void endResult(int Lost, int highestTotal) which is passed Lost (value of 1 if you lost by exceeding 21, otherwise a value of 0) and the highest point total of your hand, and prompts for and validates dealer’s total (must be greater than 16 and less than 27) and then displays whether you have won, tied or lost
Enter card (1-13): 11
Enter card (1-13): 8
Total(s): 18
Another card (1:Yes/0:No): 0
Enter dealer's total: 17
YOU WON!!
Another game (1:Yes/0:No): 1
Enter card (1-13): 10
Enter card (1-13): 1
Total(s): 11, 21
Enter dealer's total: 21
TIE
Another game (1:Yes/0:No): 1
Enter card (1-13): 13
Enter card (1-13): 5
Total(s): 15
Another card (1:Yes/0:No): 1
Enter card (1-13): 7
YOU LOST!!
Another game (1:Yes/0:No): 1
Enter card (1-13): 2
Enter card (1-13): 3
Total(s): 5
Another card (1:Yes/0:No): 1
Enter card (1-13): 9
Total(s): 14
Enter dealer's total: 22
YOU WON!!
Another game (1:Yes/0:No): -1
Error! Enter 1 for yes or 0 for no.
Another game (1:Yes/0:No): 2
Error! Enter 1 for yes or 0 for no.
Another game (1:Yes/0:No): 1
Enter card (1-13): 0
Error card must be between 1 and 13!
Enter card: 14
Error card must be between 1 and 13!
Enter card: 1
Enter card (1-13): 1
Total(s): 2, 12
Another card (1:Yes/0:No): -1
Error! Enter 1 for yes or 0 for no.
Another card (1:Yes/0:No): 2
Error! Enter 1 for yes or 0 for no.
Another card (1:Yes/0:No): 0
Enter dealer's total: 17
YOU LOST!!
Another game (1:Yes/0:No): 1
Enter card (1-13): 12
Enter card (1-13): 11
Total(s): 20
Another card (1:Yes/0:No): 1
Enter card (1-13): 1
Enter dealer's total: 16
Dealer total must be between 17 and 26!
Enter dealer's total: 27
Dealer total must be between 17 and 26!
Enter dealer's total: 26
YOU WON!!
Another game (1:Yes/0:No): 0
Test dialogue 3 for a maximum mark of 100%:
· Process unlimited number of cards
· Code and correctly use following functions:
- Functions from previous dialogue plus
- int getCard(int num, int *pTotal, int *pNumAces) to prompt for, validate and return value of card drawn where num represents the position of card to be drawn (1st, 2nd, 3rd, …), *pTotal represents the total points of cards in hand using only 1 point for each Ace, *pNumAces represents the number of Aces in hand. This function should call the validateCard and value functions.
- Replace int anotherCard() with the function int anotherCardOrGame(int value) to prompt for, validate and return response to question of another card if passed a value of 1 or the question of another game if passed a value of 0
Enter card (1-13): 1
Enter card (1-13): 10
Total(s): 11, 21
Enter dealer's total: 21
TIE
Another game (1:Yes/0:No): 1
Enter card (1-13): 11
Enter card (1-13): 1
Total(s): 11, 21
Enter dealer's total: 17
YOU WON!!
Another game (1:Yes/0:No): 1
Enter card (1-13): 10
Enter card (1-13): 12
Total(s): 20
Another card (1:Yes/0:No): 0
Enter dealer's total: 22
YOU WON!!
Another game (1:Yes/0:No): 1
Enter card (1-13): 10
Enter card (1-13): 8
Total(s): 18
Another card (1:Yes/0:No): 0
Enter dealer's total: 20
YOU LOST!!
Another game (1:Yes/0:No): 1
Enter card (1-13): 1
Enter card (1-13): 1
Total(s): 2, 12
Another card (1:Yes/0:No): 1
Enter card (1-13): 9
Total(s): 11, 21
Enter dealer's total: 17
YOU WON!!
Another game (1:Yes/0:No): 1
Enter card (1-13): 2
Enter card (1-13): 3
Total(s): 5
Another card (1:Yes/0:No): 1
Enter card (1-13): 3
Total(s): 8
Another card (1:Yes/0:No): 1
Enter card (1-13): 2
Total(s): 10
Another card (1:Yes/0:No): 1
Enter card (1-13): 4
Total(s): 14
Another card (1:Yes/0:No): 1
Enter card (1-13): 3
Total(s): 17
Another card (1:Yes/0:No): 0
Enter dealer's total: 17
TIE
Another game (1:Yes/0:No): -1
Error! Enter 1 for yes or 0 for no.
Another game (1:Yes/0:No): 2
Error! Enter 1 for yes or 0 for no.
Another game (1:Yes/0:No): 1
Enter card (1-13): 0
Error card must be between 1 and 13!
Enter card: 14
Error card must be between 1 and 13!
Enter card: 8
Enter card (1-13): 2
Total(s): 10
Another card (1:Yes/0:No): -1
Error! Enter 1 for yes or 0 for no.
Another card (1:Yes/0:No): 2
Error! Enter 1 for yes or 0 for no.
Another card (1:Yes/0:No): 1
Enter card (1-13): 1
Total(s): 11, 21
Enter dealer's total: 20
YOU WON!!
Another game (1:Yes/0:No): 0