Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 04-12-2007, 05:18 PM   #11
In Runtime
 
Daeva's Avatar
 
Join Date: Dec 2005
Posts: 407
Send a message via AIM to Daeva Send a message via MSN to Daeva Send a message via Yahoo to Daeva
Default Re: JAVA Poker Simulator Project! Help :)

ok, i'm leaving work now, i'll get home and complie it.
__________________

__________________
**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier.
Edit = Best feature ever
http://www.twitter.com/xDaevax
Daeva is offline   Reply With Quote
Old 04-12-2007, 06:33 PM   #12
Fully Optimized
 
NeXuS's Avatar
 
Join Date: Dec 2005
Posts: 2,960
Default Re: JAVA Poker Simulator Project! Help :)

Thanks man ill tweak arround see if I find any solution.
__________________

__________________
//Antec 902 V3 Case, Intel i7-2600K (@4.5GHz 1.280V watercooled w/ Antec H2O Kuhler 920), 8GB DDR3 Corsair Vengeance 1866MHz, ASUS P8P67 PRO B3, MSI 3GB N580 GTX Lightning Xtreme (@850MHz/2100MHz), 1TB Samsung Spinpoint F3, Corsair HX850W Pro Series//
//XPS 410 C2D E6400 @ 2.13GHz, 2GB DDR2 667MHz, 250GB HD, eVGA 320mb 8800GTS(605/1900MHz)//
//AMD Athlon XP +2000, Socket A MSI-6390, 768 mb of PC 2100 RAM, AGP ATI RADEON 9600SE//

I <3 TrancE
NeXuS is offline   Reply With Quote
Old 04-13-2007, 09:46 AM   #13
In Runtime
 
Daeva's Avatar
 
Join Date: Dec 2005
Posts: 407
Send a message via AIM to Daeva Send a message via MSN to Daeva Send a message via Yahoo to Daeva
Default Re: JAVA Poker Simulator Project! Help :)

Here is what I found. You're getting the error because your line:
SimpleDeck gameDeck[] = new SimpleDeck(); is creating an array that points to a single object, instead of pointing to an array. Here is my suggestion for the code, without completely understanding your code(include more comments). It eliminates the error, but I'm not quite sure about the inner workings of your program so I can't make it work, lol... So here goes:
Code:
public class Game
{
public static void main(String[] args)
{
SimpleDeck gameDeck[] = new SimpleDeck[5]; // allocate memory here, don't call SimpleDeck()'s constructor yet
String[] hand = new String[5];
System.out.println("Welcome to Video Poker");
System.out.println("Your hand");
int j = 0;
for (int i = 0; i < 5; i++)
{
 gameDeck[i] = new SimpleDeck(); // now we initialize the particular gameDeck to a new object of the simpledeck class
hand[i] = gameDeck[j].toString(); // because hand[i] is looking for a string
j++;
}
}
}
I didn't modify the other files, I used your toString() method because it was looking for a string, but when I output i'm getting the object name, and not the default toString method, have you considered creating an inheritence relationship between simpleDeck and simpleCard?
Code:
public class simpleDeck extends SimpleCard {
  simpleDeck() {
   super("","");
  }
  simpleDeck(String rank, String Suit) {
  super(rank, Suit);
 }
}
__________________
**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier.
Edit = Best feature ever
http://www.twitter.com/xDaevax
Daeva is offline   Reply With Quote
Old 04-13-2007, 10:34 AM   #14
Fully Optimized
 
NeXuS's Avatar
 
Join Date: Dec 2005
Posts: 2,960
Default Re: JAVA Poker Simulator Project! Help :)

The second piece of code I dont understand it whats super. Let me comment my code and ill post it.
__________________
//Antec 902 V3 Case, Intel i7-2600K (@4.5GHz 1.280V watercooled w/ Antec H2O Kuhler 920), 8GB DDR3 Corsair Vengeance 1866MHz, ASUS P8P67 PRO B3, MSI 3GB N580 GTX Lightning Xtreme (@850MHz/2100MHz), 1TB Samsung Spinpoint F3, Corsair HX850W Pro Series//
//XPS 410 C2D E6400 @ 2.13GHz, 2GB DDR2 667MHz, 250GB HD, eVGA 320mb 8800GTS(605/1900MHz)//
//AMD Athlon XP +2000, Socket A MSI-6390, 768 mb of PC 2100 RAM, AGP ATI RADEON 9600SE//

I <3 TrancE
NeXuS is offline   Reply With Quote
Old 04-20-2007, 12:17 PM   #15
In Runtime
 
Daeva's Avatar
 
Join Date: Dec 2005
Posts: 407
Send a message via AIM to Daeva Send a message via MSN to Daeva Send a message via Yahoo to Daeva
Default Re: JAVA Poker Simulator Project! Help :)

a call to super() means to call the constructor of the super class.
For example:
Lets say you have two classes.
Animal Class,
Bear Class.

Animal class:
Code:
public class Animal {
  private String animalName; // private class-wide instance variable for storing the animal's name
  public Animal(String name) {
    setName(name);
  } // end 1 argument constructor for Animal class
  public Animal() {
  } // end default no-argument constructor
 
  public void setName(String theName) {
    animalName = theName;
  } // end method setName
  public String getName() {
    return animalName;
  } // end method getName
} // end class Animal
Bear class:
Code:
public class Bear extends Animal {
 private String bearName; // the name of our bear
 private int bearWeight;
 public Bear(String myBearName) {
  super(myBearName); // make a call to the super-class' 1 argument constructor that takes a string
 } // end 1 argument constructor
 public Bear() {
  super(); // call the default no-argument constructor
 } // end default no-argument constructor
 public void setWeight(int weight) {
  // here we are overriding the super class' setWeight method because while a bear IS an animal, it weighs more, so we want to change the method
  bearWeight = weight *2;
 } // end method setWeight
 public int getWeight() {
  return bearWeight;
 } // end method getWeight
} // end class Bear
Zoo class:
Code:
// This is a zoo class where we have all of our animals
public class zoo {
 public static void main(String args[]) {
  Animal a1 = new Animal("Cat");
  a1.setWeight(4);
  Animal a2 = new Animal("Dog");
  a2.setWeight(25);
  // now we get into some polymorphism
  Animal b1 = new Bear("Big Bear");
  b1.setWeight(105);
  System.out.printf("%s\t%s\t\n%s\t%s\n\n%s\t%s\t\n%s\t%s\n\n%s\t%s\t\n%s\t%s\n\n", "Animal 1 is a:",a1.getName(),"It weighs:",a1.getWeight() + " lbs.","Animal 2 is a:",a2.getName(),"It weighs:",a2.getWeight() + " lbs.","Animal 3 is a:",b1.getName(),"It weighs:",b1.getWeight() + " lbs.");
 } // end method main
} // end class zoo
As you can see, the bear has a unique relationship to animal, because when you put the keyword "extends" next to your class header the class you are writing, "inherits" all of the methods of the class you are extending from(or the "super" class). so, when you say: super();, you're making a call to the super class's constructor
__________________
**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier.
Edit = Best feature ever
http://www.twitter.com/xDaevax
Daeva is offline   Reply With Quote
Old 04-20-2007, 12:23 PM   #16
In Runtime
 
Daeva's Avatar
 
Join Date: Dec 2005
Posts: 407
Send a message via AIM to Daeva Send a message via MSN to Daeva Send a message via Yahoo to Daeva
Default Re: JAVA Poker Simulator Project! Help :)

Oops... Accidental double post
__________________
**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier.
Edit = Best feature ever
http://www.twitter.com/xDaevax
Daeva is offline   Reply With Quote
Old 04-23-2007, 11:01 PM   #17
Fully Optimized
 
NeXuS's Avatar
 
Join Date: Dec 2005
Posts: 2,960
Default Re: JAVA Poker Simulator Project! Help :)

Ohhh I get it thanks!!
__________________

__________________
//Antec 902 V3 Case, Intel i7-2600K (@4.5GHz 1.280V watercooled w/ Antec H2O Kuhler 920), 8GB DDR3 Corsair Vengeance 1866MHz, ASUS P8P67 PRO B3, MSI 3GB N580 GTX Lightning Xtreme (@850MHz/2100MHz), 1TB Samsung Spinpoint F3, Corsair HX850W Pro Series//
//XPS 410 C2D E6400 @ 2.13GHz, 2GB DDR2 667MHz, 250GB HD, eVGA 320mb 8800GTS(605/1900MHz)//
//AMD Athlon XP +2000, Socket A MSI-6390, 768 mb of PC 2100 RAM, AGP ATI RADEON 9600SE//

I <3 TrancE
NeXuS is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 03:46 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0