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.
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.
Chapter6: Using Arrays
Section: Chapter Questions
Problem 10E
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
The names of the cards are stored in a text string that will have to be converted into an array. The array will be
In this project you will generate a poker hand containing five cards randomly selected from a deck of cards.
removed, reducing the size of the deck size. When the size of the deck drops to zero, a new randomly sorted deck
randomly sorted to "shuffle" the deck. Each time the user clicks a Deal button, the last five cards of the array will be
will be generated. A preview of the completed project with a randomly generated hand is shown in Figure 7-50.
5 of
Diamonds
Hands-on Project 7-2
Poker Hand
Queeen of
Hearts
P
E-X 1551014 no
15ey well
Figure 7-50 Completed Project 7-2
8 of Clubs
HANDS-ON PROJECTS
DEAL
Ace of Clubs
1334 4 of
Diamonds
303
10
T
Cards left in the current deck: 16
161
Do the following:
1. Use your code editor to open the project07-02_txt.html and project07-02_txt.js files from the js07
project02 folder. Enter your name and the date in the comment section of each file and save them as
project07-02.html and project07-02.js, respectively.
2. Go to the project07-02.html file in your code editor and link the page to the project07-02.js file, deferring the
script from loading until after the page loads. Save your changes to the file.
Go to the project07-02.js file in your code editor. Within the onclick event hander, add the commands
docerib](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Ff37e66db-881a-46b5-ba1b-98fe2bd03f7d%2Fdd927989-12ca-4607-91e5-9306d0438c25%2Fvtkqskn_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Hands-On Project 7-2
The names of the cards are stored in a text string that will have to be converted into an array. The array will be
In this project you will generate a poker hand containing five cards randomly selected from a deck of cards.
removed, reducing the size of the deck size. When the size of the deck drops to zero, a new randomly sorted deck
randomly sorted to "shuffle" the deck. Each time the user clicks a Deal button, the last five cards of the array will be
will be generated. A preview of the completed project with a randomly generated hand is shown in Figure 7-50.
5 of
Diamonds
Hands-on Project 7-2
Poker Hand
Queeen of
Hearts
P
E-X 1551014 no
15ey well
Figure 7-50 Completed Project 7-2
8 of Clubs
HANDS-ON PROJECTS
DEAL
Ace of Clubs
1334 4 of
Diamonds
303
10
T
Cards left in the current deck: 16
161
Do the following:
1. Use your code editor to open the project07-02_txt.html and project07-02_txt.js files from the js07
project02 folder. Enter your name and the date in the comment section of each file and save them as
project07-02.html and project07-02.js, respectively.
2. Go to the project07-02.html file in your code editor and link the page to the project07-02.js file, deferring the
script from loading until after the page loads. Save your changes to the file.
Go to the project07-02.js file in your code editor. Within the onclick event hander, add the commands
docerib
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Knowledge Booster
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.Recommended textbooks for you
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT