Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the file named assignment 0 5 - start.js ( provided with this assignment ) to get started. This assignment can be completed in three

Use the file named assignment05-start.js (provided with this assignment) to get started. This
assignment can be completed in three stages: Students should complete stage 1 before
proceeding to the 2nd stage, and complete that before stage 3. Take note of the comments in
the provided .js file and follow the suggestions they provide for what to code and where.
STAGE 1- Card
Define a constructor function or class for representing a playing Card. The constructor must
require the following three parameters:
- face eg: "9","10", "Jack"
- value eg: 9,10,10(an ace would get a value of 1)
- suit eg: "Diamond", "Spade", "Club", "Heart"
Include with the Card Object a function called describeSelf() that will return a string description
following this format: "FACE of SUITs. Value: VALUE" eg: "King of Hearts. Value: 10".
Instantiate a single Card object for a King of Hearts (or any card of your choice), invoke the
describeSelf() function on the Card and display the results to the browser.
STAGE 2- Deck
Update the constructor that has already been defined for the Deck class so that it will
instantiate the 52 Card Objects required to populate a Deck. Due to the limitations of function
scope, you may need to use nested for loops (instead of nested forEach() loops) with the
arrays already defined for you. Each new Card Object instantiated should be added to the Deck
variable array named cards using the Array.push() function.
Instantiate a new Deck, shuffle() the cards and run several rounds of the dealCard() then
describeSelf() functions, displaying the results to the web browser each time.

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 Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions

Question

1. Discuss the four components of language.

Answered: 1 week ago

Question

f. What stereotypes were reinforced in the commercials?

Answered: 1 week ago