Preview

It210 Inchworm Code

Satisfactory Essays
Open Document
Open Document
256 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
It210 Inchworm Code
Check Point: Interation Control Structure * Design a program that models the worm’s behavior in the following scenario. Be sure to include the completed analysis section:

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.

-------------------------------------------------
I think I rewrote this about 7 times. haha

Worm decreases distance to apple every move by 1 worm length
Loop until worm length is <= 1 worm length from apple
When the worm moves to <=1 worm length enter apple

Process

Get worm length
Get distance from apple
Calculate distance (movement)
Output result

Input

Length of worm (from keyboard)
Distance from apple

Output

Worm length * 1when Distance < Worm length
Write “Worm has entered apple!”
End

Main Module

Declare, Inches, WormLength, DistanceRemaining As Real
Call Welcome Message module
Call Input Data module
Call Calculations module
Write “Nom Nom”
End

Process

Display program title
Display directions
Get worm length
Get distance from apple
Calculate distance (movement)
Output result

Input

Length of worm (from keyboard)
Distance from apple

Output

Worm length * 1.5 when Distance < Worm length
Write “Worm has entered apple!”
End

Program
Declare, Inches, wormLength, DistanceRemaining As Real
Set wormLength = 1 Inch
DistanceRemaining = Inches
If DistanceRemaining <= wormLength
Then Enter
Otherwise
Repeat wormLength = 1.5 * wormLength
Return to wormLength
Enter Apple
Eat Apple
End

You May Also Find These Documents Helpful

  • Satisfactory Essays

    IT220 Lab 7

    • 303 Words
    • 2 Pages

    The benefits of a partial in the cost and a full meh would be required where large sums of money and data are exchanged and can have almost none down time.…

    • 303 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Write a 1,050- to 1,450-word summary in which you address the following for each of the three major phases in the simulation:…

    • 266 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Ambrosia Beetle Hypothesis

    • 1318 Words
    • 6 Pages

    determine the rate of infection. The same calculations should be done for the control groups to…

    • 1318 Words
    • 6 Pages
    Good Essays
  • Good Essays

    It273 Unit 3

    • 676 Words
    • 3 Pages

    | A hub is a device that takes incoming data and broadcasts it out to all the other devices that are connected to its ports.…

    • 676 Words
    • 3 Pages
    Good Essays
  • Good Essays

    It210 Week 4 Psuedocode

    • 584 Words
    • 3 Pages

    Program Pseudocode Currency_Convertor Main Module Delcare USDollars As Float Declare Rate1 As Float Declare Rate2 As Float Declare Rate3 As Float Declare Rate4…

    • 584 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    ITNW 2335

    • 402 Words
    • 2 Pages

    6. What are three main types of high-bandwidth connection options used by medium- to large-sized businesses?…

    • 402 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Choose one of the Facts for Consideration sections from Ch. 3 of the text and list the page number for the section you chose. Then, complete the following table. List five threats appropriate to the environment from the section you chose. Rate the risk for each threat from 0 (low) to 10 (high). Then, list five appropriate countermeasures. Once you complete the table, write a brief explanation of the countermeasures for the two threats with the highest risk total, stating how the countermeasure reduces the risk associated with that threat.…

    • 616 Words
    • 3 Pages
    Good Essays
  • Good Essays

    It250

    • 272 Words
    • 2 Pages

    Which of the following symbols instructs the shell to redirect the output of a command to the specified file instead of the screen and overwrite the file?…

    • 272 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Read through all of the tasks carefully, so that you know what you will need to do to complete this assignment.…

    • 1187 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    IT140 Ip1

    • 1028 Words
    • 5 Pages

    Windows 7 operating system was produced for personal computers, business desktops, laptops, netbooks, tablet PCs, and media center PCs. This version was released on October 22, 2009, which was less than three years that Windows Vista was released. Windows 7 upgraded design worked with Windows Vista applications and its hardware. A few of Windows 7 new features are the advances in touch and handwriting recognition. It supports RAW image format with the addition of Windows Imaging Component. This enables previewing and metadata display in Internet explorer. Also full size viewing for slideshows in Windows Photo Viewer.…

    • 1028 Words
    • 5 Pages
    Satisfactory Essays
  • Good Essays

    Review each scenario below, and choose one to complete for your assignment. Each scenario contains specific questions that will ask you to provide examples, explain your suggestions for improvement, and refer to the lesson. Be sure to respond to each question in complete sentences.…

    • 1746 Words
    • 7 Pages
    Good Essays
  • Satisfactory Essays

    read

    • 311 Words
    • 2 Pages

    Choose one of the Facts for Consideration sections from Ch. 3 of the text and list the page number for the section you chose. Then, complete the following table. List five threats appropriate to the environment from the section you chose. Rate the risk for each threat from 0 (low) to 10 (high). Then, list five appropriate countermeasures. Once you complete the table, write a brief explanation of the countermeasures for the two threats with the highest risk total, stating how the countermeasure reduces the risk associated with that threat.…

    • 311 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Itm 301

    • 909 Words
    • 4 Pages

    frequently require fine-granularity sharing of data and fast response times. Groupware can be divided into three…

    • 909 Words
    • 4 Pages
    Good Essays
  • Good Essays

    National Guard Essay

    • 581 Words
    • 3 Pages

    The National Guard has to be called immediately, if there is the statewide disaster that means that the disaster should have the large scope and affect the state. The military involvement is essential to conduct the emergency management fast, effectively, and successfully. The National Guard may be called by the state’s governor in response to the emergency that civilian emergency services cannot cope with and when there is the threat to the public safety. For example, the flood and evacuation of the population may raise the problem of the transportation and looting. The National Guard may be called out by the state’s governor to ensure that the private property and civilians are protected from possible illegal actions, such as looting.…

    • 581 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Review each scenario below, and choose one to complete for your assignment. Each scenario contains specific questions that will ask you to provide examples, explain your suggestions for improvement, and refer to the lesson. Be sure to respond to each question in complete sentences.…

    • 1445 Words
    • 6 Pages
    Good Essays

Related Topics