Code problem
Hello,
There is an always compile time error occured in the below codes.
The reason is derived from second constructor . I think everything is going well.
So whyy?
publicclass Card{
// properties
String faceValue;
String suit;
// constructor
public Card(String suit, String faceValue)
{
this.faceValue = faceValue;
this.suit = suit;
}
public Card(int posNumber)
{
String[] suit1 ={"hearts","diamond","spades","clubs"};
String[] faceValue1 ={"1","2","3","4","5","6","7","8","9","10","11","12","13"};
}
int division = posNumber / 13;
int remain = posNumber % 13;
for(int a = 0; a <= division ; a++){
if(a == division)
suit = suit1[a];
}
for(int b = 0; b <= remain; b++){
if(b == remain)
faceValue = remain1[b];
}
}
// methods
public String getSuit(){
return suit;
}
public String getfaceValue(){
return faceValue;
}
public String toString(){
return faceValue +"\t," + suit ;
}
}

