Simple Black Jack Card Game Help !
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Simple Black Jack Card Game Help !

  1. #1
    Join Date
    Jan 2011
    Posts
    1

    Exclamation Simple Black Jack Card Game Help !

    For A School Project You Are Suppose To Make A D.O.S Game With The Following Concepts That We Learned : variable, calculations, input/output, decision making structures (if or switch statements), loops, arrays, methods.

    Very Basic Stuff...

    I've Chosen To Do Blackjack But Now I'm Stuck...

    Can Anyone Please Help Me Finish This Code...



    import java.util.Scanner;

    public class BlackJack{

    static int player; // User's Points.
    static int computer; // Computer's Points.
    static int card;
    static int cardsMade = 0; // How Many That Cards That Have Been Created In Total.

    public static void main (String[] args) {
    display();

    deckCreator();

    deckShuffler();

    winnerCheck();
    }


    public static void display() { // Asks The User If He/She Wants To Start Playing Or Not.
    String choice="";
    System.out.println("\nWW WW lll TTTTTTT ");
    System.out.println("WW WW eee lll cccc oooo mm mm mmmm eee TTT oooo ");
    System.out.println("WW W WW ee e lll cc oo oo mmm mm mm ee e TTT oo oo");
    System.out.println(" WW WWW WW eeeee lll cc oo oo mmm mm mm eeeee TTT oo oo");
    System.out.println(" WW WW eeeee lll ccccc oooo mmm mm mm eeeee TTT oooo ");
    System.out.println("");
    System.out.println("BBBBB lll kk JJJ kk !!! ");
    System.out.println("BB B lll aa aa cccc kk kk JJJ aa aa cccc kk kk !!! ");
    System.out.println("BBBBBB lll aa aaa cc kkkkk JJJ aa aaa cc kkkkk !!! ");
    System.out.println("BB BB lll aa aaa cc kk kk JJ JJJ aa aaa cc kk kk ");
    System.out.println("BBBBBB lll aaa aa ccccc kk kk JJJJJ aaa aa ccccc kk kk !!! ");

    Scanner input = new Scanner(System.in);
    while (!(choice.equals("s") || choice.equals("q"))) {
    System.out.print("Press s to start playing or q to quit: ");
    choice=input.nextLine();
    }

    if (choice.equals("s")) {

    }

    else if (choice.equals("q")) {
    System.out.print("\nHope you try Blackjack next time.\n");
    }
    }


    public static void deckCreator() { // Creates An Unshuffled Deck Of Cards.
    int cardsMade = 0;
    deck = new cards [52];
    for (int cardType = 0; cardType <=3; cardType++) {
    for (int cardNumber = 0; cardNumber <=14; cardNumber++) {
    deck[cardsMade] = new Card(cardNumber,cardType);
    cardsMade++;
    }
    }
    }

    public static void deckShuffler() { // Shuffels The Unshuffled Deck.
    int random;
    for (int a = 0; a < cards.length; a++) {
    random = (int)math.random();
    random = random *(i+1);
    }



    public static void playerTurn() { // Asks The User If He Wants To Take A Hit.
    String choice="";
    Scanner input = new Scanner(System.in);

    while (!choice.equals("y") || choice.equals("q"))) {
    System.out.print("Would you like to be hit ? [y = Yes / n = No] : ");
    choice=input.nextLine();
    }

    if (choice.equals("s")) {



    else if (player >= 21) {


    }

    public static void boolean computerTurn() {
    boolean hit =

    public static void winnerCheck() { // Makes Decission On Who The Winner Is.
    if (computer == 21) {
    System.out.println("Dealer wins with " +computer);
    }
    else if (computer > 21) {
    System.out.println("Dealer lost with " + computer + "!");
    }
    else if (player > 21) {
    System.out.println("Sorry, you lost with" +player);
    }
    else if (player == 21) {
    System.out.println("Congratulations, You win with " + player + "!");
    }
    }
    }

  2. #2
    Join Date
    Feb 2008
    Posts
    966

    Re: Simple Black Jack Card Game Help !

    Please place your code, properly formatted, inside of the code tags so that we can read it.

    What problems are you having? Nobody on here is going to just look through your code and finish your homework for you. You need to tell us what the problem is and where you are stuck. If you have any errors, post the stack trace.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center