Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2.Please explain the purpose of Rand, getNumber, and showWinner in the program s

ID: 3626822 • Letter: 2

Question

2.Please explain the purpose of Rand, getNumber, and showWinner in the program shown below.

//////////////////////////////////////////
Module main()

Declare Integer computer, player

Declare String playerChoice, computerChoice


Set computer = Rand(1, 3)

Call getNumber(player)

Call showWinner(computer, player)
End Module
///////////////////////////////////////


3. For the code snippet shown below, what will be shown as output?
///////////////////////////////////////
Declare String week[7]= "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
Declare Integer index
For index = 1 to 7
Display "Day ", index, week(index)
End For
///////////////////////////////////////////////



4. Why might statements like the ones shown below be written?

If a=23 and b=21, what are the contents of a, b, and temp for each of the three statements when they are executed sequentially?
/////////////////////////////////////////////
Set temp = a

Set a = b

Set b = temp
///////////////////////////////////////////////

Explanation / Answer

please rate - thanks

2.Please explain the purpose of Rand, getNumber, and showWinner in the program shown below.
without the rest of the code this is an educated guess
///////////////// /////////////////////////
Module main()

Declare Integer computer, player

Declare String playerChoice, computerChoice


Set computer = Rand(1, 3)//get a random number between 1 and 3

Call getNumber(player)get a number for the player

Call showWinner(computer, player)show who the winner is
End Module
///////////////////////////////////////


3. For the code snippet shown below, what will be shown as output?
///////////////////////////////////////
Declare String week[7]= "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
Declare Integer index
For index = 1 to 7
Display "Day ", index, week(index)
End For
///////////////////////////////////////////////
Day 1 Sun
Day 2 Mon
Day 3 Tue
Day 4 Wed
Day 5 Thu
Day 6 Fri
Day 7 Sat




Day 24. Why might statements like the ones shown below be written?

If a=23 and b=21, what are the contents of a, b, and temp for each of the three statements when they are executed sequentially?
/////////////////////////////////////////////
Set temp = a     

Set a = b

Set b = temp
///////////////////////////////////////////////

temp=23
b=23
a=21