Having trouble with code in DrJava
So in my csi class my assignment is to create a method called getCardCount() inside a class called Deck, that has an array of cards called cards, which then needs to be initialized.
so, the method getCardCount() has to be an integer and it needs to return the amount of cards currently in a deck.
So right now i have this :
public class Deck
private Card cards;
public Deck(int numCards)
this.cards = new Card[(int)numCards];
public int getCardCount()
int cardCount = 0;
for(int index = 0; index < cards.length; index++)
cardCount = cardCount + cards[index];
but, whenever i try to compile it keeps telling me that "13: operator + cannot be applied to int,Card"
I'm not sure what else i should try because that looks right to me..
unless...should i be looping through strictly 52 (ex : for(int index = 0; index < 52; index++) etc?