there is already a class called Card.java with 52 cards. And in the Deck.java i have to write a constructor to initialize the 52 cards in a row with suite and value. i wrote the following code but it failed the public test..Can anybody help me out?
public class Deck {
private Card[] cards;
private final int DECK_SIZE=52;
public Deck(){
this.cards=new Card[DECK_SIZE];
int index = 0;
for (int suit = 0; suit <= 3; suit++) {
for (int value = 1; value <= 13; value++) {
this.cards[index] = new Card (suit, value);
index++;
}
}
}
public Deck(Deck other) {
this.cards= new Card[DECK_SIZE];
for(int i=1;i<=DECK_SIZE;i++){
this.cards[i]= other.cards[i];
}