
-----------------------------------
implosion
Wed May 21, 2008 9:34 pm

Bubble Sort with a 2D array ??
-----------------------------------
I have a assignment that involves me outputting a deck in order, shuffling it and then using multiple sorts to sort them back. i'm using blue j. i keep getting an error on this line 

                        if (Deck
import javax.swing.*;
import java.util.*;
import java.util.Random;

class CardAssignment1{ 



   public static void main(String args[]){

      String temp;
      String Deck[][] = new String[4][13];
      int s,c, card;
      Random randint = new Random();
      String ans;
      int ans1;
      int numberofpass=0;
      int cardnum;
      
      
      for(int Suit = 0 ; Suit  and < operators only work for numerical values.

You'll have to use the .compareTo() method of String. Read this: http://www.javabeginner.com/java-string-comparison.htm

-----------------------------------
shadowman544
Sat May 24, 2008 8:26 pm

Re: Bubble Sort with a 2D array ??
-----------------------------------
i believe a way to make this a little more in depth would be to make an object called "card" with for say the variables to hold suit and value(a,2-10 and j,q,k). you should then perhaps make another obect called "deck" and give it the contents of a deck of cards (52cards a-k) and the required methods to act as a deck (ex. shuffle and deal) and an object that is a "player" and an object called "hand"(play,pickup). This may eliminate your need for a 2d array.
