Find Jobs
Hire Freelancers

C Blackjack Program

$30-250 USD

Completed
Posted about 15 years ago

$30-250 USD

Paid on delivery
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
Project ID: 408221

About the project

9 proposals
Remote project
Active 15 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hello.. Please, check PMB...
$50 USD in 1 day
5.0 (2 reviews)
1.8
1.8
9 freelancers are bidding on average $98 USD for this job
User Avatar
hi, just new at gaf, but experienced at rac. let us do it for u.
$30 USD in 1 day
4.9 (15 reviews)
5.0
5.0
User Avatar
Hi, Please check PM Thankx
$150 USD in 3 days
5.0 (52 reviews)
5.1
5.1
User Avatar
Dear Sir, SERIOUS BIDDER. Please check PM. Regards, Jainam Shah, iSoft Solutions.
$160 USD in 1 day
4.7 (6 reviews)
4.5
4.5
User Avatar
Please see pmb, thank u.
$129 USD in 1 day
5.0 (4 reviews)
3.7
3.7
User Avatar
Hello Sir/Madam. Please check your PMB. Regards.
$100 USD in 1 day
5.0 (1 review)
1.3
1.3
User Avatar
Please see PMB. Balthazaar.
$150 USD in 5 days
0.0 (0 reviews)
0.0
0.0
User Avatar
This is simple. Please consider my bid.
$75 USD in 3 days
0.0 (1 review)
0.0
0.0
User Avatar
Hey, I am new to GAF. But u can expect the best.
$40 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of CANADA
Stouffville, Canada
5.0
7
Member since Mar 26, 2009

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759) & Freelancer Online India Private Limited (CIN U93000HR2011FTC043854)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.