Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*Please stick EXACTLY to the requirements of the task. I DON'T need anything extra. Please solve it as minimalistic as possible (while still executing all

*Please stick EXACTLY to the requirements of the task. I DON'T need anything extra. Please solve it as minimalistic as possible (while still executing all requirements). Pay attention to the note at the end.*

Develop a Web page with a JavaScript script that generates and displays a hand of five cards from a pack of 52 cards. First, create an array that contains the names and numbers of 13 playing cards: "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King" Then create a second array containing the four suits:"Hearts", "Diamonds", "Clubs", "Spades" Use a for loop that iterates five times (for five cards) through both arrays. In each iteration of the loop, use the Math.random() method to generate two random numbers in order to select a card name or number, and a suit from the arrays, and display the resulting card in the browser window. The random numbers should be used to index into the appropriate array.

The format of the output should be Card 1: 4 of Diamonds Card 2: Ace of Clubs Etc.

Note The Math.random() method returns a random number between 0 and 1. To generate a random integer in the range from min to max (where min and max are two integers, min < max) use a function as follows:

function getRandomInt(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min + 1)) + min; } var num1 = getRandomInt(0, 12); var num2 = getRandomInt(0, 3);

where num1 is the random integer in the range from 0 to 12 that you will use to select a card name or number and num2 is the random integer in the range from 0 to 3 that you will use to select a suit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions

Question

=+ (d) Show that \, (He 0) =0 and A*(H) =1.

Answered: 1 week ago