The names of the cards are stored in a text string will be converted into an array. The array will be randomly sorted to "shuffle" the deck.  Each time the user clicks a Deal button, the last five cards of the array will be removed, reducing the size of the deck size. When the size of the deck drops to zero, a new randomly sorted deck will be generated. A preview of the completed project with a randomly generated hand is shown in Figure 7-50.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In this project you will generate a poker hand containing five cards randomly selected from a deck of cards. The names of the cards are stored in a text string will be converted into an array. The array will be randomly sorted to "shuffle" the deck.  Each time the user clicks a Deal button, the last five cards of the array will be removed, reducing the size of the deck size. When the size of the deck drops to zero, a new randomly sorted deck will be generated. A preview of the completed project with a randomly generated hand is shown in Figure 7-50.

**Hands-On Project 7-2: Generating a Poker Hand**

In this project, you will generate a poker hand containing five cards randomly selected from a deck of cards. The names of the cards are stored in a text string that must be converted into an array. This array will be shuffled randomly to simulate deck shuffling. Each time the user clicks the "Deal" button, the last five cards of the array will be removed, reducing the deck's size. Once the deck size reaches zero, a new randomly sorted deck will be created. A completed project preview with a randomly generated hand is shown in Figure 7-50.

---

**Figure 7-50: Example Poker Hand**

- **Displayed Poker Hand:**
  - 5 of Diamonds
  - Queen of Hearts
  - 8 of Clubs
  - Ace of Clubs
  - 4 of Diamonds

- **Remaining Cards in Deck:** 16

- **Interaction:** Button labeled "DEAL" for generating a new hand.

---

**Instructions:**

1. Open your code editor and access the `project07-02_txt.html` and `project07-02_txt.js` files located in the `js07` folder. Add your name and date in the comment section and save them as `project07-02.html` and `project07-02.js`.

2. Edit the `project07-02.html` to link with the `project07-02.js` file, deferring script load until the page loads. Save your modifications.

3. Edit the `project07-02.js` file. Inside the `onclick` event handler, include commands for dealing a new hand as per the project requirements.
Transcribed Image Text:**Hands-On Project 7-2: Generating a Poker Hand** In this project, you will generate a poker hand containing five cards randomly selected from a deck of cards. The names of the cards are stored in a text string that must be converted into an array. This array will be shuffled randomly to simulate deck shuffling. Each time the user clicks the "Deal" button, the last five cards of the array will be removed, reducing the deck's size. Once the deck size reaches zero, a new randomly sorted deck will be created. A completed project preview with a randomly generated hand is shown in Figure 7-50. --- **Figure 7-50: Example Poker Hand** - **Displayed Poker Hand:** - 5 of Diamonds - Queen of Hearts - 8 of Clubs - Ace of Clubs - 4 of Diamonds - **Remaining Cards in Deck:** 16 - **Interaction:** Button labeled "DEAL" for generating a new hand. --- **Instructions:** 1. Open your code editor and access the `project07-02_txt.html` and `project07-02_txt.js` files located in the `js07` folder. Add your name and date in the comment section and save them as `project07-02.html` and `project07-02.js`. 2. Edit the `project07-02.html` to link with the `project07-02.js` file, deferring script load until the page loads. Save your modifications. 3. Edit the `project07-02.js` file. Inside the `onclick` event handler, include commands for dealing a new hand as per the project requirements.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

I need javascript, not C#

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Running Time of Application
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education