Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 67 - CodePilot V5.0 C6
P. 67

    Step  8      If needed, press the sandwich down or cut it in half.

                     Step  9      Enjoy your sandwich.
                     Step  10     End

                     Example 2: Create an app that shows ‘Hello’ when a button is clicked in MIT App Inventor.

                     Step   1     Start
                                 1.1  Open MIT App Inventor in your browser.

                                 1.2  Click New project and name it HelloApp.

     Algorithmic intelligence refers to the ability of a computer or machine to follow a set of predefined   Step  2    Design the Screen
     instructions, known as an algorithm, to solve problems or perform tasks.        2.1  Drag a Button onto Screen1, rename it ButtonHello and set the Text to “Say Hello”.
                                 2.2  Drag a Label onto Screen1, rename it LabelOutput and leave the text blank.

     ALGORITHM       Step  3      Add the Behaviour (Blocks Editor)

                                 3.1  Open the Blocks tab.
     An algorithm is a set of step-by-step instructions or rules designed to perform a specific task or
     solve a problem. It provides a clear and structured approach to find a solution. Algorithms can be         3.2  From ButtonHello, drag the event block “when ButtonHello.Click do”.
     used in various fields, such as computing, mathematics and daily activities.        3.3   From LabelOutput, drag the setter “set LabelOutput.Text to” and snap it inside
                                      the event block.
     GUIDELINES FOR WRITING ALGORITHMS        3.4   From Text blocks, drag a text literal, type “Hello” and connect it to the setter.

     When writing an algorithm, it’s important to break down the problem into clear and simple steps   Step  4    Test the App
     that are easy to follow. Some guidelines to follow when writing algorithms are:
                                 4.1  Connect a device or emulator.
       Begin with the required information (Input).        4.2   Run the app, tap “Say Hello” and verify   Test your algorithm manually

       Explain each action clearly so anyone can follow it.  that “Hello” appears in LabelOutput.  with sample inputs to find
       End after a certain number of steps.  The first computer algorithm   Step  5    End      errors early.
     was written by Ada Lovelace
       The algorithm should give the same result every time if you
     start from the same point.  in 1843.                      ACTIVITY-1

     SOLVING PROBLEMS USING ALGORITHMS  Arrange the following steps  in the  correct  order to  form an algorithm  for preparing  a
     Let’s look at a few examples to understand how algorithms can be applied to everyday activities.  PowerPoint presentation on “Planet vs Plastic.”

     Example 1: Making a sandwich    Practice presentation.                       Insert pictures and charts.

     Step  1    Start
                               Open PowerPoint and pick a theme.                  Save and export.
     Step  2    Gather materials: bread, butter, cheese and chopped vegetables.

     Step  3    Take two slices of bread.    Collect facts and pictures.          Make the Title slide.
     Step  4    Spread butter on one side of each slice.    Keep the design neat.     Check the slides.

     Step  5    Place cheese and chopped vegetables on one slice.
                               Add simple animations.
     Step  6    Put the other slice of bread on top.
     Step  7    Make sure the sandwich is properly put together.

                                                                                                                      65
                                                                                    Algorithms, Flowcharts & System Maps

| 62 63 64 65 66 67 68 69 70 71 72 |