Display binary cards with dots representing a number between 0 and 31

Challenge Level: Ready to expand

Learning outcomes

Students will be able to:

Requirement:

Write a program that asks the user to enter a decimal number between 0 and 31 as the input and displays the binary cards (5 black or white cards) representing the number in binary as the output.

Testing examples:

Your program should display the outputs shown in this table for the given inputs provided;

Input Output
31 All five white binary cards are shown.

11 Three white binary cards are shown, one with eight dots, one with tow dots and one with one dot.

Languages

Scratch

What it should look like

Click on the green flag to see the expected output of your program.

Hints

We have provided 4 different solutions to code this program, based on two template programs.

The first three sample solutions are based on remixing this program. Remix this program and change its name to: Binary challenge 9 (version 1).

For this version, all cards should change to black when the green flag is pressed, and then a program can work through each of the bit values and broadcast to a card if it should change costume.

The fourth variation is based on remixing this program. Remix this program and change its name to: Binary challenge 9 (version 2).

This solution displays 5 cards (with dots showing for all the cards) on the screen and asks the user to enter a number between 0 and 31. It then clones a black card sprite over the cards which need to be hidden (dots not showing).

The fourth variation should work like this:

Show solution