Skip to content

Activity 2, #2 is probably wrong #2

@skwh

Description

@skwh

You've listed "3" as the answer for number two on Activity 2.

Consider the deck initialized with the statements below. How many cards does the deck contain?
String[] ranks = {"jack", "queen", "king"};
String[] suits = {"blue", "red"};
int[] pointValues = {11, 12, 13};
Deck d = new Deck(ranks, suits, pointValues);

However earlier in the guide, it says a deck initialized with three ranks, two suits, and three values creates six cards:

Deck constructor — This constructor receives three arrays as parameters. The arrays contain
the ranks, suits, and point values for each card in the deck. The constructor creates an
ArrayList, and then creates the specified cards and adds them to the list.
For example, if ranks = {"A", "B", "C"}, suits = {"Giraffes", "Lions"},
and values = {2,1,6}, the constructor would create the following cards:
["A", "Giraffes", 2], ["B", "Giraffes", 1], ["C", "Giraffes", 6],
["A", "Lions", 2], ["B", "Lions", 1], ["C", "Lions", 6]
and would add each of them to cards. The parameter size would then be set to the size of
cards, which in this example is 6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions