CheckPoint Iteration Control Structure

CheckPoint Iteration Control Structure - Display...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CheckPoint Iteration Control Structure Design a program that models the worm’s behavior in the following scenario: A worm is moving toward an apple. Each time it moves, the worm cuts the distance between itself and the apple by its own body length until the worm is close enough to enter the apple. The worm can enter the apple when it is within a body length of the apple.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Start Main module Declare Length,Distance as float
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Display "Enter the length of the worm" Input Length Display "Enter the distance of worm from the apple " Input Distance Call MoveWorm Module End main module MoveWorm module While Distance >= 0 Distance = Distance - WormLength End While Display "The worm has reached the apple !." End MoveWorm module...
View Full Document

This note was uploaded on 08/14/2011 for the course IT 210 taught by Professor Josephpillera during the Spring '10 term at University of Phoenix.

Page1 / 2

CheckPoint Iteration Control Structure - Display...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online