Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.
Become a Premium Member and unlock a new, free course in leading technologies each month.
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
public int computeHandValue(ArrayList <Card> hand)
{
int sum = 0;
int numAces = 0;
for(Card c: hand){
int value = c.getCardValue();
sum += value;
if(c.getRank().equals("Ace"))numAces++;
}
if(sum<12 && numAces >0)sum += 10;
}
return sum;;
}
public int computeHandValue(ArrayList <Card> hand)
{
int sum = 0;
int numAces = 0;
for(Card c: hand){
int value = c.getCardValue();
sum += value;
if(c.getRank().equals("Ace"))numAces++;
}
if(sum<12 && numAces >0)sum += 10;
return sum;;
}
public class Card {
//contentsof class ghere
}
public class DeckOfCrads {
//contetsn of class here
}
public int computeHandValue(ArrayList <Card> hand)
{
int sum = 0;
int numAces = 0;
for(Card c: hand){
int value = getCardValue(c);
sum += value;
if(c.getRank().equals("Ace"))numAces++;
}
if(sum<12 && numAces >0)sum += 10;
return sum;;
}
public int getCardValue(Card c)
String rank = hand.getCardValue();
for(rank.equals("Ace") >=1)&&(getCardValue()<12)
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.