Worm to apple

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

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

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
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

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern