Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me finish my code, Draw Card button will display 5 randomly selected

ID: 3536138 • Letter: P

Question

Please help me finish my code, Draw Card button will display 5 randomly selected cards

and total text box will display the total values of the cards. also i need a flush counter,

which counts everytime you get a flush.(all cards same type)

before you click draw it must show 5 cards with picture of their backs

card pictures are in the same folder with the index file, and their names are like

for hearts:> card1h.jpg , card2h.jpg, card3h.jpg...

for spades:> card1s.jpg, card2s.jpg, card3s.jpg...

for club:> card1c.jpg, card2c.jpg, card3c.jpg...

for diamonds:> card1d.jpg, card2d.jpg, card3d.jpg...

<!doctype html>
<html>
<head>

<script type="text/javascript">

function start()
{
var Card1Image=document.getElementById("card1")
var Card2Image=document.getElementById("card2")
var Card3Image=document.getElementById("card3")
var Card4Image=document.getElementById("card4")
var Card5Image=document.getElementById("card5")
assignCards();
}

function assignCards()
{
for(var i = 0;i<13;++i)
Cards[i]="card"+(i+1)+"h";
for(var i = 13;i<26;++i)
Cards[i]="card"+(i-12)+"c";
for(var i = 26;i<39;++i)
Cards[i]="card"+(i-23)+"s";
for(var i = 39;i<52;++i)
Cards[i]="card"+(i-34)+"d";
}
var Cards=new Array(52);
function drawCards()
{
shuffle();



}
function shuffle()
{
for(var i=0;i<53;++i)
{
var temp= Cards[i]
Cards[i]=Cards[j]
Cards[i]=temp;
}
setImage(CardImage,i);
}
function setImage(CardImage,i)
{
cardImage.setAttribute("card",Cards[i]+".jpg");

checkflush();

}

function checkflush()

{

var suit=Cards[0].charAt(Cards[0].length()-1)
var suit=new Array(5);
for (var i=0;i<5;++i)
suit[i]=cards[i].charAt(Cards[i].length()-1);
var s = suite[0];
for (var i=1;i<5;++i)
if (s != suite[i])
{
return false;
}
else{
return true;
}
}
</script>
</head>
<body>

<img id="card1" src="card.jpg">
<img id="card2" src="card.jpg">
<img id="card3" src="card.jpg">
<img id="card4" src="card.jpg">
<img id="card5" src="card.jpg">

<button >Draw Cards</button>

<input type="text" id="checkflush" value="0"></input>
</body>
</html>


Explanation / Answer

CHECK THIS ADRESS


http://www.briggsoft.com/docs/pmavens/Utilities.htm

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote