Worm to apple - Input Distance Display{The distance between...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
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 one body length of the apple. Main Module Input Module Calculations Module Output Module Main Module Declare Length as real Declare Distance as real Call Get Length Call Get Distance Call Move Worm End Input Data Module Write What Distance from worm to apple
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Input Distance Display {The distance between the worm and apple is “ “} End Distance Write What is worms body length Input body length Display {The worm’s length is “ “} End body length Calculations Module While (distance >= body length){distance = distance – body length} When Distance = 0 Write “Worm has reached the apple." End Move Worm Output Module Write Distance is: Distance Write body length is: Body Length Write End Move Worm is: Distance = 0...
View Full Document

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

Ask a homework question - tutors are online