Programming Logic Essay

1487 WordsMay 18, 20136 Pages
Programming Logic and Design, 6th Edition Chapter 5 Exercises 1. What is output by each of the pseudocode segments in Figure 5-22? Answer: |a. |5, 22, 5 | |b. |4, 6, 7 | |c. |5, 6 | |d. |Goodbye | | |Goodbye | | |Goodbye | | |Goodbye | | |Goodbye | |…show more content…
Find the Bugs 13. Your student disk contains files named DEBUG05-01.txt, DEBUG05-02.txt, and DEBUG05-03.txt. Each file starts with some comments that describe the problem. Comments are lines that begin with two slashes (//). Following the comments, each file contains pseudocode that has one or more bugs you must find and correct. Answer: Please see the DEBUG05-01.txt, DEBUG05-02.txt, and DEBUG05-03.txt solution files. Game Zone 14. In Chapter 2, you learned that in many programming languages you can generate a random number between 1 and a limiting value named LIMIT by using a statement similar to randomNumber = random(LIMIT). In Chapter 4, you created the logic for a guessing game in which the application generates a random number and the player tries to guess it. Now, create the guessing game itself. After each guess, display a message indicating whether the player’s guess was correct, too high, or too low. When the player eventually guesses the correct number, display a count of the number of guesses that were required. Answer: A sample solution is as follows: Flowchart: [pic] Pseudocode: start Declarations num myRandomNumber num guess num count num LIMIT string PROMPT = “Enter a number between 1 and “ string CORRECT = “You guessed correctly!” string HIGH = “You
Open Document