Preview

Prelude to Programming 5e Ch04 1 1

Satisfactory Essays
Open Document
Open Document
23004 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Prelude to Programming 5e Ch04 1 1
Repetition Structures:
Looping

4

In this chapter, we will begin to explore the topic of repetition structures
(also called loops). Loops contain a block of statements that can be executed repeatedly. We will discuss different types of loops and more advanced loop applications. The discussion of loops continues in Chapter 5.

ISBN 1-256-14455-X

After reading this chapter, you will be able to do the following:
Distinguish between pre-test and post-test loops [Section 4.1]
Identify infinite loops and loops that never get executed [Section 4.1]
Create a flowchart using the loop structure [Section 4.1]
Use relational and logical operators in loop conditions [Section 4.1]
Construct counter-controlled loops [Section 4.2]
Use counter-controlled loops to increment or decrement the counter by any integer value [Section 4.2]
Construct For loops [Section 4.3]
Create test conditions to avoid infinite loops and loops that never get executed [Section 4.3]
Construct sentinel-controlled loops [Section 4.4]
Use the Int function [Section 4.4]
Apply loops to data input and validation problems [Section 4.4]
Apply loops to compute sums and averages [Section 4.4]

163
Prelude to Programming: Concepts and Design, Fifth Edition, by Stewart Venit and Elizabeth Drake. Published by Addison-Wesley. Copyright © 2011 by Pearson Education, Inc.

164

Chapter 4

In the
Everyday
World

Repetition Structures: Looping

Loops
You may not remember, but you probably learned to walk about the time you were a year old. As you took your first step you had to figure out how to execute the following process:
Put one foot in front of the other
At some point you did just that, and it was a major accomplishment. But this didn’t get you very far. If you wanted to walk across the room, you needed to extend this process to the following:
Put the left foot in front of the right foot
Put the right foot in front of the left foot
Put the left foot in front of the right foot
Put the right foot in front of the left

You May Also Find These Documents Helpful

  • Satisfactory Essays

    unit 7 assignment 1

    • 431 Words
    • 2 Pages

    5. What three actions do count-controlled loops typically perform using the counter variable? Initialization: Before the loop begins, the counter variable is initialized to a starting value. Test : The loop tests the counter variable by comparing it to a maximum value. If the counter variable is less than or equal to the maximum, the loop iterates. If the counter is greater than the maximum value, the program exits the loop. Increment : To increment a variable means to increase its value. During each iteration, the loop increments the counter variable by adding a predetermined amount to it…

    • 431 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    PT1420week5exdkinney

    • 404 Words
    • 2 Pages

    References: Gaddis, T. (2010). Starting out with programming logic & design. Boston, MA: Addison- Wesley/Pearson Education, Inc.…

    • 404 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    This is our first individual assignment for Programming unit this semester. This assignment was given in December 2013, and submission date is on 10th February 2014.…

    • 1859 Words
    • 8 Pages
    Good Essays
  • Better Essays

    Venit, S., & Drake, E. (2011). Prelude to Programming Concepts and Design (5th ed.). Boston, MA: Addison-Wesley.…

    • 1800 Words
    • 6 Pages
    Better Essays
  • Powerful Essays

    Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 Chapter 24 Chapter 25 Chapter 26 Chapter 27 An Introduction to Hardware, Software, and the Internet An Introduction to Software Development Objects and Classes Algorithms Java Syntax and Style Data Types, Variables, and Arithmetic Boolean Expressions and if-else Statements Iterative Statements: while, for, do–while Implementing Classes and Using Objects Strings Class Hierarchies and Interfaces Arrays…

    • 3908 Words
    • 16 Pages
    Powerful Essays
  • Powerful Essays

    EAS230Syllabus

    • 1748 Words
    • 8 Pages

    An introduction to computer programming with an emphasis on problem solving will be presented. Specific topics include:…

    • 1748 Words
    • 8 Pages
    Powerful Essays
  • Good Essays

    c. Modify the program of Part b so that at the option of the user, it displays…

    • 300 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    It/210 Course Design

    • 2571 Words
    • 11 Pages

    Explain how a structured approach relates to developing programs and why using an organized approach is important. Course Design Guide IT/210 Version 5 CheckPoint Input Data and Output Process Resources: Appendix B, Appendix C Read the following scenario: You want to build a program that will keep track of your CD and DVD collection at home. Use the table in Appendix C to complete this CheckPoint.…

    • 2571 Words
    • 11 Pages
    Satisfactory Essays
  • Good Essays

    11. Using a floating-point value as a control variable in a loop, but failing to account for the effects of floating-point precision, can cause a loop to execute much differently than expected.…

    • 719 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    carloe :)

    • 253 Words
    • 2 Pages

    Problem: Write an interactive Java calculator application that calculates sum, difference, product, and quotient of two numbers. The program prompts the user for the first number, the second number, and the operator ( +, -, *, / ). Display the result based from the chosen operator.…

    • 253 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Intro the Programming

    • 386 Words
    • 5 Pages

    In general terms, a program that is broken into smaller units of code, such as methods, is known as a(n) _______.…

    • 386 Words
    • 5 Pages
    Satisfactory Essays
  • Powerful Essays

    It 210 Weeks

    • 2760 Words
    • 12 Pages

    Venit, S., & Drake, E. (2011). Prelude to programming: Concepts and design (5th ed.). Boston, MA: Addison-Wesley.…

    • 2760 Words
    • 12 Pages
    Powerful Essays
  • Satisfactory Essays

    cross the shoes the same, since I was first learning. The first step to tie my shoes is cross the…

    • 83 Words
    • 1 Page
    Satisfactory Essays
  • Good Essays

    II. Identify the infinite loop in the source code. During an infinite loop a program often does not return output or accept input. Start by looking at the code in the area after the last successful input or output action occurred.…

    • 733 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Java the Amazing Language

    • 7935 Words
    • 32 Pages

    Liu, S., Deng, C., Li, X., & Gaudiot, J. (2009). RHE: A Lightweight JVM Instructional Tool. Annual IEEE International Computer Software and Applications Conference, 01, 612-619.…

    • 7935 Words
    • 32 Pages
    Good Essays

Related Topics