5. Make 10 of them. Add 1 to x, and find the next square. Keep going until x =10 6. Write the algorithm. 1. let x = 0 2. square = x × x 3. add 1 to x 4. if x = 10 stop otherwise go to step 2 7. Follow the steps in the algorithm to verify the algorithm solves the problem. Check that there are 10 numbers generated. Check that each one is a perfect square. Check that no perfect squares were missed. Try It! Another method for generating perfect squares is to add the next odd number to the square. Notice that 0 + 1 = 1, 1 + 3 = 4, 4 + 5 = 9, and 9 + 7 = 16. Identify the pattern in these four equations. Use computational thinking to write an algorithm to generate the first 10 perfect squares. Comparing Problem-Solving to Computational Thinking Some problems do not require a computer calculation. Other problems are unsolvable. The process of problem-solving can be applied to any problem you encounter. Problem-solving is at its roots a perfectly human endeavor. Com- putational thinking is a subset of the actions of problem-solving. This section compares problem-solving and computational thinking. General problem-solving can be used to answer questions. This is true whether or not a computer is used. Defining and specifying the purpose and goals of problem-solving involve steps or strategies like those for computational thinking, as shown in Figure 1-5. 1. Understand the problem statement. 2. Study the causes of the problem. 3. Brainstorm solutions. 4. Identify and implement one of the solutions. 5. Verify that the solution solved the problem. Computational thinking results in an algorithm. Problems where the data can be numerically and textually analyzed are good candidates for computer solutions. Problems not solved by a computer are not considered in computa- tional thinking. For example, a teacher makes a seating chart based on a variety Goodheart-Willcox Publisher Figure 1-5. Problem-solving is the process of choosing a course of action after assessing existing information and weighing the costs and benefits of different actions. Problem-Solving 1 Understand the problem statement 2 Study the causes of the problem 3 Brainstorm solutions 5 Verify that the implemenation solved the problem 4 Identify and implement one of the solutions Copyright Goodheart-Willcox Co., Inc. 10 Introduction to Computer Science: Java Programming
Previous Page Next Page