subject

Consider the playGame procedure below which calls on 3 other procedures: countFives, player1Move, and player2Move.

PROCEDURE playGame()

{

cards = []

REPEAT_UNTIL ( countFives(cards) >= 5 )

{

card1 = player1Move()

APPEND (cards, card1)

card2 = player2Move()

APPEND (cards, card2)

}

}

The procedure above simulates a certain card game called "fives" - played with two decks of cards - in which each player takes a turn playing a card, until 5 fives have been played in total, at which point it's "Game Over." The procedure uses a list called cards which is initially empty. Each round of play, two cards are appended to the list.

Here is the countFives procedure.

PROCEDURE countFives(cards)

{

count = 0

FOR EACH card IN cards

{

IF( card = 5 )

{

count = count+1

}

}

}

Which of the following should replace the at line 12 to make the procedure work as designed?

A. DISPLAY (count)

B. DISPLAY ("game over")

C. RETURN (count)

D. RETURN ("game over")

E. Nothing. Procedure works as is.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 16:30
Corey set up his presentation for delivery to his team.the information he had to convey was critical to their job performance.he knew he would need a lot of time to explain each point
Answers: 3
question
Computers and Technology, 22.06.2019 18:00
Budgets you to do all of the following expect a) send frivolously b) avoid over spending c) gain financial independence d) examine your priorities and goals
Answers: 2
question
Computers and Technology, 23.06.2019 06:00
What makes myhexadecimalnumber a child of mynumber? which methods does myhexadecimalnumber inherit directly from the mynumber class? what can an instance of the mynumber class do? what can an instance of the myhexadecimalnumber class do? which methods are overridden? why are they overridden? how many examples of overloading are there? why was this done? where is the super keyword used? what is it doing? why isn’t the incoming value set immediately in the second myhexadecimalnumber constructor? how many examples can you find of an inherited method being called?
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
The basic work area of the computer is it screen that you when you first fire up your computer
Answers: 1
You know the right answer?
Consider the playGame procedure below which calls on 3 other procedures: countFives, player1Move, an...
Questions
question
Mathematics, 23.03.2020 19:43
Questions on the website: 13722359