DOC PREVIEW
CSUDH TBE 540 - Logo Lesson 4

This preview shows page 1-2-17-18-19-36-37 out of 37 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Logo Lesson 4PrerequisitesObjectives“Debugging”Slide 5Slide 6Slide 7Slide 8Keyboard InputSlide 10Slide 11Slide 12Keyboard Input ExampleSlide 14Slide 15Self Check Lesson 4Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Locating Logo WebsitesLocating Logo Articles/BooksSlide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Slide 36Lesson 4 QuizLogo Lesson 4TBE 540-40Fall 2004Farah FisherPrerequisites•Create basic and complex shapes using Logo procedures•Create Logo procedures that use variables.•Create a complex shape using simple shapes with variables.•Access the world wide web using a browser.•Use a search engine to find information.•Download text and graphics from the web.Objectives•Given a Logo procedure that does not work, correct all errors.•Create a Logo procedure that accepts input from the keyboard while running.•Locate articles and presentations about Logo.•Locate websites about Logo.“Debugging”•When a program (e.g. a Logo procedure) is written, it does not often work correctly the first time.•Correcting errors in a program is called “debugging”.•The term comes from the 1940s when moths were interfering with the operation of mainframe computers that used telephone relays as switches.“Debugging”•In order to debug a program, it is necessary to know…the programming language being used andwhat the program is supposed to do.•First look for typos (misspelled commands, missing [ ], incorrect spacing, etc.).“Debugging”•Then look carefully at each line of the program and “run it in your head” or try the results on paper, step by step. Make no assumptions…do exactly what the program commands say to do.•If the program is complex, try making one change at a time, then running the program again.“Debugging”•Look at the Logo command below. It is supposed to make a square.REPEAT 4 [ FD50 RT 50 ]•In looking for typos, you will notice that the space in FD50 is missing.•The other error requires knowledge of Logo.•Stepping through the program shows that a turn of 50 degrees is not enough to make a square.“Debugging”•Try the debugging exercise at http://www.csudh.edu/fisher/tbe540/LW4.htm•Possible answers are available.Keyboard Input•In Lesson 3, you learned about variables, and how to use MAKE and RANDOM to give variables a value.•It is sometimes useful for the person who is running the procedure to put numbers into variables by typing them while the procedure is running.Keyboard Input•Two Logo commands can be used for this purpose:READLISTREADCHARACTER (or RC or READCH or READCHAR)•Both of these commands bring in information from the keyboard while a procedure is running.Keyboard Input•READLIST can bring in any amount of information…everything the user types until Return/Enter is pressed.•READCHARACTER (or RC or READCH or READCHAR) brings in just one character (one keystroke).Keyboard Input•READLIST and READCHARACTER are used with MAKE to fill up a variable.•Examples:MAKE “NAME READLISTEverything typed until a Return/Enter is put into :NAMEMAKE “X FIRST READLISTOnly information up to the first space is put into :X (prevents extraneous information)MAKE “Z READCHARACTERThe first key pressed (no Return) is put into :ZNOTE: This is useful for “Press any key to continue.”Keyboard Input Example•The procedure below asks for the user to enter the size for a square and then draws it. PR prints a message on the screen (message is between the square brackets [ ]).TO INSQUAREPR [ENTER SIZE AND PRESS RETURN]MAKE “SIZE FIRST READLIST SQUARE :SIZEEND•The procedure assumes that SQUARE with a variable is already in POTS (any variable name is OK for SQUARE).Keyboard Input Example•The procedure below asks for the user to press any key to continue. NOTE: CS clears the screen.TO MESSAGESPR [HERE IS THE FIRST MESSAGE]PR [PRESS ANY KEY TO CONTINUE.]MAKE “C READCHARCSPR [HERE IS THE SECOND MESSAGE]ENDKeyboard Input•See other samples at http://www.csudh.edu/fisher/tbe540/LHO4.htmSelf Check Lesson 4•The line below should make a triangle. It has one or more errors. Where are the errors?REPET 4 [ FD100 RT 60]Self Check Lesson 4•The line below should make a triangle. It has one or more errors. Where are the errors?REPET 6 [ FD100 RT 60]REPEATshould be 3 for a triangleneeds a spaceFD 100not enough degrees, should be 120 foreach of 3 turnsSelf Check Lesson 4•The following Logo commands were entered. The error message was NOT ENOUGH INPUT. What’s wrong?TO RECTANGLE :L :WREPEAT 2 [FD :L LT 90 FD :W LT 90]ENDRECTANGLE 100Self Check Lesson 4•The following Logo commands were entered. The error message was NOT ENOUGH INPUT. What’s wrong?TO RECTANGLE :L :WREPEAT 2 [FD :L LT 90 FD :W LT 90]ENDRECTANGLE 100•Since there are two variables after RECTANGLE in the procedure definition, two numbers should have been typed to start the procedure.Self Check Lesson 4•Which of the Logo command below takes a single letter from the keyboard and puts it into a variable called :KEYS?•MAKE “KEYS READLIST•READLIST “KEYS•READCHAR “KEYS•MAKE “KEYS READCHARSelf Check Lesson 4•Which of the Logo command below takes a single letter from the keyboard and puts it into a variable called :KEYS?•MAKE “KEYS READLIST•READLIST “KEYS•READCHAR “KEYS•MAKE “KEYS READCHARSelf Check Lesson 4•You want to display the message ENTER YOUR NAME, get the name and put it into a variable called :WHOM Will the lines below work?•[ENTER YOUR NAME]•MAKE :WHOM READCHARSelf Check Lesson 4•You want to display the message ENTER YOUR NAME, get the name and put it into a variable called :WHOM Will the lines below work? No, see changes in blue.•PR [ENTER YOUR NAME]•MAKE “WHOM READLISTLocating Logo Websites•You will need to find 5 websites about Logo for your bibliography.•Remember to record the complete address and write a brief description.•When you use a search engine such as http://www.google.com, use Logo programming as the search term.•This should remove websites about shirt logos, etc. from the list.Locating Logo Articles/Books•You need to include 5 articles, presentations or books about Logo in your bibliography (references and descriptions).•Articles, presentations, and books about Logo can be found through the CSUDH Library at


View Full Document

CSUDH TBE 540 - Logo Lesson 4

Download Logo Lesson 4
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Logo Lesson 4 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Logo Lesson 4 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?