1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Programming project. blackjack, String array issue

  1. Dec 10, 2012 #1
    Not sure what's going one, as soon as I remove the line with String[] arraySuit... all errors go away. With that statement in I get errors on several lines. Cannot figure out what's wrong.

    Code (Text):
     * Semester Project
     * Blackjack Class
    package project;
    import java.util.*;

     * Oliver Paquin
     * CIS132
     * December 10, 2012

    class Blackjack
        //declare and set arrays for suits and cards
        String[] arraySuit = {"Hearts", "Diamonds", "Spades" "Clubs"};
        int[] arrayCards = {1,2,3,4,5,6,7,8,9,10,11,12,13};
        int number1, number2;
        public int dealCards()
            //Create Random class object
            Random randomNumbers = new Random();
            number1 = randomNumbers.nextInt(3);
            number2 = randomNumbers.nextInt(12);  
            //Display random numbers for testing
            return number1;

    1. The problem statement, all variables and given/known data

    2. Relevant equations

    3. The attempt at a solution
  2. jcsd
  3. Dec 10, 2012 #2


    User Avatar
    Homework Helper
    Gold Member

    Could it be because you're missing a comma between "Spades" and "Clubs"?

    (Since "Spades" and "Clubs" are separate strings in the array, they need to be separated by a comma.)
  4. Dec 10, 2012 #3
    Thanks...tomorrow I'm going to get my eyes checked.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook