Answered step by step
Verified Expert Solution
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 assignmentstart.js provided with this assignment to get started. This
assignment can be completed in three stages: Students should complete stage before
proceeding to the nd stage, and complete that before stage Take note of the comments in
the provided js file and follow the suggestions they provide for what to code and where.
STAGE Card
Define a constructor function or class for representing a playing Card. The constructor must
require the following three parameters:
face eg: "Jack"
value eg: an ace would get a value of
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:
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 Deck
Update the constructor that has already been defined for the Deck class so that it will
instantiate the 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started