Hi, I need so help in the right direction. Don't know if im going in the right direction or not.
I have a card class and a deck class that models the hans. Now I have tor create two special hands that will play two
sperate games depending on which game is choosen them it will declare a winner.
First I have to create a generic hand class. The hand has array of cards with no specified amount
THis is what I have so far:
public class Hand
{
private Card[] myHand;//array of cards user specifies
int cardsInHand =0;//counter keep track of the number of cards in any dealt hand
/**
* Constructor for objects of class Hand
*/
public Hand()
{
myHand = new Card[cardsInHand];//needs to be able to allow user to specify the number of cards.
int cardsInHand = 0;
for (int suit = 0; suit <= 3; suit++)
{
for(int face = 1; face <=13; face++)
{
myHand[cardsInHand] = new Card(face,suit);
cardsInHand++;
}
}
}
*** This is how I populated the deck. but not sure if this right for the Hand. The hand has cards in it and the
card has a suit and a face. so the cards will go in hand until numofcards is specified by which game is chooesen.
next I have to create two special card games. One game has 3 cards but can not contain cards with value of 10,9,8.
This is what I have. It does not compile wanted to know if I was thinking correctly though.
public class BriscolaHand extends Hand
{
// instance variables - replace the example below with your own
private Card[] myBrisHand;//array of Briscola Hand
/**
* Constructor for objects of class BriscolaHand
*/
public BriscolaHand()
{
myBrisHand = new Hand[3];
int cardsInHand = 0;
do{
for (int suit = 0; suit <= 3; suit++)
{
for(int face = 1; face <=13; face++)
{
myBrisHand[cardsInHand] = new Hand();
cardsInHand++;
}
}
}while ((Card.face != 10)||(Card.face != 9) ||(Card.face != 8));
}
**Do i reference card or Hand, Not sure though(ie. myBrisHand = new Card).
Please guide me in the right direction or let me know if Im way off.