class Card { } constructor (face, suit) { this.face = face this.suit = suit CARD_COUNT =...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
class Card { } constructor (face, suit) { this.face = face this.suit = suit CARD_COUNT = 52 let cards = [] faces = ["A",2, 3, 4, 5,6,7,8,9,10,"J", "Q", "K"] suits = ["Hearts", "Diamonds", "Clubs", "Spades"] class Dealer { } constructor () { this.getDeckOfCard() this.shuffle() getDeckOfCard() { for (let count = 0; count < this.CARD_COUNT; count++) this.cards [count] = new Card(this.faces [count % 13]) this.suits [Math .floor(count / 13)] shuffle() { for (let firstCard = 0; firstCard < this.CARD_COUNT; firstCard++) let secondCard = Math.floor(Math.random() * this.CARD_COUNT) let tempCard = this.cards [firstCard] cards [firstCard] = secondCard cards [secondCard] = tempCard function buildPlayingCard (card, suitIcon, faceColor, suitColor) { return `<div class="card player-card"><div class="card-title" style="text-align: left; font-size: 20px; padding-left: 10px; color: ${faceColor}">${card.face}</div><div class="card-content" style="font-size: 28px; padding-bottom: 25px; "><span class="${suitIcon)" style="color: ${suitColor}"></span></div></div> document.getElementById("btnDealCards").onclick= function myFunction() { let dealer new Dealer() dealer.shuffle() let cardOutputWithIcon - ** for (const card of cards) // or for (const card of dealer.cards) not sure if it correct { switch(card.suit) { case "Hearts": cardOutputWithIcon + buildPlayingCard(card, "mdi mdi-heart", "red", "red") //use https://pictogrammers.github.io/@mdi/font/6.9.96/ } break case "Diamonds": cardOutputWithIcon + buildPlayingCard(card, "mdi mdi-cards-diamond", "red", "red") break case "Clubs": cardOutputWithIcon + buildPlayingCard(card, "mdi mid-cards-club", "black", "black") break case "Spades": cardOutputWithIcon + buildPlaying Card (card, "mdi mid-card-spade", "black", "black") document.getElementById("result").innerHTML = cardOutputWithIcon console.log(cardOutputWithIcon) Set the CSS #player-card-container to a display of grid with four columns, a padding of 10 pixels, and a grid gap of 10 pixels Welcome to the Card Game! Return 9 + 1 5 8 0 Card Dealer Deal Cards Shuffled Cards 2 ♥ ♦ ♥ 10 0 3 > + ♥ ♦ 9 8 ♦ The result: It didn'tt come out with any err but it didn't come out with anything either. Please help! (Use javaScript) wwwwwww class Card { } constructor (face, suit) { this.face = face this.suit = suit CARD_COUNT = 52 let cards = [] faces = ["A",2, 3, 4, 5,6,7,8,9,10,"J", "Q", "K"] suits = ["Hearts", "Diamonds", "Clubs", "Spades"] class Dealer { } constructor () { this.getDeckOfCard() this.shuffle() getDeckOfCard() { for (let count = 0; count < this.CARD_COUNT; count++) this.cards [count] = new Card(this.faces [count % 13]) this.suits [Math .floor(count / 13)] shuffle() { for (let firstCard = 0; firstCard < this.CARD_COUNT; firstCard++) let secondCard = Math.floor(Math.random() * this.CARD_COUNT) let tempCard = this.cards [firstCard] cards [firstCard] = secondCard cards [secondCard] = tempCard function buildPlayingCard (card, suitIcon, faceColor, suitColor) { return `<div class="card player-card"><div class="card-title" style="text-align: left; font-size: 20px; padding-left: 10px; color: ${faceColor}">${card.face}</div><div class="card-content" style="font-size: 28px; padding-bottom: 25px; "><span class="${suitIcon)" style="color: ${suitColor}"></span></div></div> document.getElementById("btnDealCards").onclick= function myFunction() { let dealer new Dealer() dealer.shuffle() let cardOutputWithIcon - ** for (const card of cards) // or for (const card of dealer.cards) not sure if it correct { switch(card.suit) { case "Hearts": cardOutputWithIcon + buildPlayingCard(card, "mdi mdi-heart", "red", "red") //use https://pictogrammers.github.io/@mdi/font/6.9.96/ } break case "Diamonds": cardOutputWithIcon + buildPlayingCard(card, "mdi mdi-cards-diamond", "red", "red") break case "Clubs": cardOutputWithIcon + buildPlayingCard(card, "mdi mid-cards-club", "black", "black") break case "Spades": cardOutputWithIcon + buildPlaying Card (card, "mdi mid-card-spade", "black", "black") document.getElementById("result").innerHTML = cardOutputWithIcon console.log(cardOutputWithIcon) Set the CSS #player-card-container to a display of grid with four columns, a padding of 10 pixels, and a grid gap of 10 pixels Welcome to the Card Game! Return 9 + 1 5 8 0 Card Dealer Deal Cards Shuffled Cards 2 ♥ ♦ ♥ 10 0 3 > + ♥ ♦ 9 8 ♦ The result: It didn'tt come out with any err but it didn't come out with anything either. Please help! (Use javaScript) wwwwwww
Expert Answer:
Answer rating: 100% (QA)
Based on the screenshots provided it appears youre trying to display a shuffled deck of playing cards within a web page using JavaScript HTML and CSS ... View the full answer
Related Book For
Understanding Basic Statistics
ISBN: 9781111827021
6th Edition
Authors: Charles Henry Brase, Corrinne Pellillo Brase
Posted Date:
Students also viewed these programming questions
-
It has been a long-held practice that the NCAA does not believe in paying players from any sport to play or profit from the use of their name or image. Their belief has always been that student...
-
You are to program to play fish against the computer. The rules of fish can be found on many internet sites. A sample explanation of the game as taken from Wikipedia is: Five cards are dealt from a...
-
You have been selected as a team member of a new presidential council designed to repair, replenish and grow the economy, as well as, sustain the financial markets. The team is designed to take on...
-
In Exercises 3542, describe and sketch the surface given by the function. f(x, y) = Jxy, 0, x 0, y 0 x <0 or y < 0
-
If a 90% confidence interval for the difference of means 1 2 contains all negative values, what can we conclude about the relationship between 1 and 2 at the 90% confidence level?
-
Use a decision tree to illustrate how a risk-neutral plaintiff in a lawsuit decides whether to settle a claim or go to trial. The defendants offer \( 60,000\) to settle. If the plaintiff does not...
-
The school Spanish Club is sponsoring a trip to Mexico that will cost \($1,000\) per student. Your parents will contribute \($300\), but you need to save the remaining \($700\) over the next four...
-
Flexible budgets, 4-variance analysis. (CMA, adapted) Nolton Products uses standard costing allocates manufacturing overhead (both variable and fixed)to products on the basis of standard direct...
-
An ARM for $100,800 is made at a time when the expected startrate is 5 percent. The loan will be made with a teaser rate of 2percent for the first year, after which the rate will be reset. Theloan 2...
-
Real option analysis can be used to alter the timing, scale, or other aspects of an investment in response to market conditions. Businesses face the dilemma of whether to invest in a project or...
-
(a) Prove that Z({yk+1}) = zY(2) zyo- %3D where Y(2) = Z({yk+1})- %3D 2- 3 (b) What is the inverse Z-transform of Y(2) z(z + 2)2
-
Sales Cost of sales 100% Variable 50% Fixed 10% 60% Gross profit 40% Operating Expenses Variable Fixed Operating Income 20% 15% 35% 5% For the coming year, the expected total sales amounts to P19.50...
-
Crown Co. can produce two types of lamps, the Enlightner and Foglighter. The data on the two lamp models are as follows: Foglighter 530 Sales volume in units Enlightner 630 Unit sales price $300 $400...
-
State and classify the items given below as per Theory Of Constraints: 1.Depreciation of a machinery 2.Rental utilities 3.R&D costs 4.Equipment & building costs 5.Raw materials in stock 6.Sales of a...
-
Omega Company is planning to invest in a machine that costs P825,000 with a 15-year economic life. The economic life of the machine is same with its useful life. The new machine is expected to...
-
what is at least one advantage and disadvantage to group incentive plans? Which side of the issue do you support (for/against)? Why?
-
1 . ABC Manufacturing Corp is considering investing in new equipment to improve its production efficiency. The company has two options: Option A: Purchase new state - of - the - art equipment for $ 1...
-
Review Exhibit 11.4. Analyze each product on the graph according to the characteristics that influence the rate of adoption. For example, what can you conclude from the data about the relative...
-
In the airline business, on-time flight arrival is important for connecting flights and general customer satisfaction. Is there a difference between summer and winter average on-time flight arrivals?...
-
A random sample of 5222 permanent dwellings on the entire Navajo Reservation showed that 1619 were traditional Navajo hogans (Navajo Architecture: Forms, History, Distributions by Jett and Spencer,...
-
Suppose we have a binomial experiment with n = 40 trials and a probability of success p = 0.50. (a) Is it appropriate to use a normal approximation to this binomial distribution? Why? (b) Compute ...
-
The Pauli spin matrices in quantum mechanics are given by the following matrices: \(\sigma_{1}=\left(\begin{array}{ll}0 & 1 \\ 1 & 0\end{array} ight), \sigma_{2}=\left(\begin{array}{cc}0 & -i \\ i &...
-
Find the eigenvalue(s) and eigenvector(s) for the following: a. \(\left(\begin{array}{ll}4 & 2 \\ 3 & 3\end{array} ight)\) b. \(\left(\begin{array}{ll}3 & -5 \\ 1 & -1\end{array} ight)\) c....
-
For the matrices in the previous problem, compute the determinants and find the inverses, if they exist.
Study smarter with the SolutionInn App