TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
michael vergotis
NA
1
7.6k
Problem with blackjack
Oct 19 2010 4:35 AM
Hi, I am making a blackjack game for an assignment.
The classes were given to us so they are all correct.
I am struggling with 2 parts.
1. searching for ace and asking if they want a 1 or 11
2. displaying the points of each hand
In the class the code for the cards facevalue is
public enum FaceValue {
Two , Three , Four , Five , Six , Seven , Eight ,
Nine , Ten , Jack , Queen , King , Ace
I know i need to give them a number value also.Below is the code that deals two cards to the player and dealer and shows them to the screen. However i think i need to implement a switch statement to make the facevalues return a number instead of a word.
can anyone advise how and where to do this.
public TwentyOne() {
hands[PLAYER] = new ArrayList();
hands[DEALER] = new ArrayList();
/// <summary>
/// Plays Twenty-one
/// </summary>
///
public void Play() {
pack.Shuffle();
hands[PLAYER].AddRange(pack.DealTwoCards());
hands[DEALER].AddRange(pack.DealTwoCards());
DisplayHand(hands[PLAYER], "Player");
DisplayHand(hands[DEALER], "Dealer");
i apologise if i have done something incorrectly as i am new to this forum.
Reply
Answers (
1
)
Problem with creating a login form
MouseClick