Skip to main content

Section 12.12 Unit 2a Subgoal Labeled Puzzles for Toggle Code

These are copies of the Selection Mixed Up Code Practice puzzles with subgoal labels added. The Selection Toggle Code Practice page uses them as the Get Help puzzles for its write code problems. Each branch of an if statement is one block, so one label sits on each branch.

Activity 12.12.1.

The following program segment should print if your guess is correct, too high, or too low. But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.12.2.

The following program segment should print either β€œYou can go out” if you don’t have any homework and have cleaned and otherwise should print β€œYou can not go out”. But the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.12.3.

The main method in the following class should print if x is in the range of 1 to 10 (inclusive) or not. But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.12.4.

The main method in the following class should print out if a string has the word β€œringing” in it or not. But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.12.5.

The main method in the following class should print if your favorite food is junk food (pizza or wings) or not. But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.12.6.

The main method in the following class should print your fine if you are speeding. If you are going over 65 but less than 75 the fine is 50. If you are going at least 75 and less than 85 the fine is 100. Over that the fine is 200. It does not print anything if you are not speeding. But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.12.7.

The main method in the following class should print the alarm time. If it is a weekday you should get up at 7:00am and if not get up at 10:00am. But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.12.8.

The main method in the following class should print if you can text now. You can text if you are not driving and not eating. But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.12.9.

The main method in the following class should print if your name starts with a vowel or not. But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.12.10.

The main method in the following class should print your grade for score. But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.12.11.

The get_mid(str) method in the StringWorker class should return the middle character if the string has an odd number of characters and the middle two characters if the string has an even number of characters. For example, get_mid("way") should return "a" and get_mid("away") should return "wa". The blocks have been mixed up and include extra blocks that are not needed in a correct solution.
You have attempted of activities on this page.