Home
Lesson PDF
Contents
1. Delete the line containing Locate Select I O and then Output Print Type in What is your name and press EXE Select I O and then Input I nputStr Type in Name and press EXE Type in Print Name and press EXE Run your program Frogram Loader More I nput from User a Return to the Program Editor Folder msin TJ Type in Print How old finputstr Name Name Hella gt rnt Mame are you and press Print How old are you PUL ge EXE Print n 3 years you will Type in Input Ageand print age s press EXE Hello ClassPadder Type in Print In 5 What is your name i Diane years you will be and Hou didi are vou press EXE In 3 years you will be 182 Type in Print Age 5 and press EXE Run your program Program Editor What is the difference between I nput and I nputStr InputStr treats what we input as a string In programming we call text strings text is made up of a string of characters Input treats what we input as a value that we can perform calculations on Copyright c 2008 CASIO COMPUTER CO LTD All Rights Reserved 6 3 Viewing a Variable s Contents a When we ran our Variable Manager ES Name Egi program values were Diane l i i lee l Nameandage ip eR _ el Name and Age O Hello PROM 236 I ml Name STR E b To view their contents O Today PRGM aff 1g select Variable Manager c Double click on the STR stands for String STR indi
2. try to complete Lesson 16 right away Please take a few moments to copy and paste the following three questions at the end of your Lesson15 document and answer them 1 Approximately how long did it take you to complete this lesson 2 Which activity did you find particularly useful 3 Did you find any part of this activity difficult to follow If so which part Also how did you overcome the difficulty Assessment 15 Introduction to Programming e Checkpoint Your word processed document titled Lesson15 should contain the following activities 1 Three screen captures from PART I 2 Three screen captures from PART II 3 4 Four questions with answers and three reflection questions Four screen captures from PART III with answers from PART IV e Submit your Lesson15 document to your instructor for grading Once your lesson is submitted your lesson for ClassPad 101 Intro to Programming is complete Copyright c 2008 CASIO COMPUTER CO LTD All Rights Reserved 12
3. CLASSPA LOD aaa lesson 15 Introduction to Programming Welcome There are many different types of programming languages programming language has its own syntax or style for entering instructions To program in a particular language you must learn the syntax of the language In any programming language we are writing instructions for the computer or device to follow Programming is logical and fun Lesson Goals To gain a general understanding of programming To write a simple program showing output To write a simple program asking for input To write a program that averages three numbers In Lesson 15 you will learn how to Write a program to display output Write a program to accept input Use an If Then statement Upon completion of this lesson you will be able to answer the following questions 1 2 3 4 5 What command do you use to display text What command do we use to clear the display window What command would you type to place the words You won at position 10 50 in the display window If Then statements must end with what command What is a walk through in the programming world Time required About 60 minutes Getting Started We will begin this lesson by creating a simple program Once you learn how to find commands and understand the ClassPad s syntax style you will be able to create interesting programs When we write a program the text we type in is called code When we run a pro
4. age You can ride the bicycle o If they are under 5 years of age display the message Ask your mother or father for a ride o If they are less than 0 years old display the message You are not born yet Run your program and input an age of 15 With the output window showing get a screen capture Paste it into your Lesson15 document under a title of PART III Run your program and input an age of 8 With the output window showing get a screen capture Add two blank spaces following the first screen capture and then paste this one Run your program and input an age of 3 With the output window showing get a screen capture Add two blank spaces following the last screen capture and then paste this one Run your program and input an age of 43 With the output window showing get a screen capture and then paste it on the next line Copyright c 2008 CASIO COMPUTER CO LTD All Rights Reserved 11 PART IV Written Exercises Please copy and paste the following questions into your Lesson15 document under a title of Part IV and answer them 1 What command do you use to display text 2 What command would you type to place the words You won at position 10 50 in the display window 3 If Then statements must end with what command 4 What is a walk through in the programming world Reflection Exercises You have just completed the fifteenth lesson in ClassPad 101 We will continue to write programs in Lesson 16
5. am what happens o We input a number Assume you input 12 o 12 is stored inn n 12 o 12 gt 10 so Large number is printed o Program ends If we run the program again what happens o We input a number Assume you input 5 o 5 is stored inn n 5 o 5 gt 10 is false o Program ends nothing is printed Using a pencil and paper try walking through program b with n 1 n 15 and n 3 Write down what you think the output will be for each When finished type in the program and then run it with n 1 n 15 and n 3 How do these answers compare with your walk through results Try walking through program c with n 1 n 15 and n 3 This program is organized a little better Remember programs will do exactly what we instruct them to do BOCA Msp ereere LOA rep Else Else Print Negative number Print Negative number fEnd fEnd Program Editor Program Editor Program Editor Copyright c 2008 CASIO COMPUTER CO LTD All Rights Reserved 10 PART III Practice Exercises 1 Begin a new program named Drive by clicking and inputting the program name Write a program using an If Then Else statement that will do the following Ask the user what their name is Ask the user their age Display the user s name On the next output line o If they are 15 years or older display the message You can drive the car 0 If they are between 5 years and 14 years of age display the mess
6. cates a main folder to open it variable type that is used to store a d Double click on the word or words a string of letters aed aia a its contents i e Notice the variable Name is of type STR Program Loader a Program Loader a 4 Viewing a Variable s Contents Continued Variable Manager Eg i an Hed eoublo click gr the variable Age b am so old c Notice the variable Age is of type EXPR d Also notice our programs are listed here e Double click on one of your program names to see what happens EXPR stands for Expression EXPR indicates a variable type that is used to store a value that can be used in calculations TEDT Frogram Loader How do we average numbers In the Part II practice exercises you will write a program to find the average of three grades Remember to find an average we add the values and then divide by the number of values we added For example to average 80 92 and 88 we find 80 92 88 3 In general to average grades a b and c we find a b c 3 Copyright c 2008 CASIO COMPUTER CO LTD All Rights Reserved 7 PART II Practice Exercises 10 11 12 13 14 Begin a new program named Average by clicking and inputting the program name Input code to display the message Averaging Test Scores in the upper left corner of the display window Remember to input the line of code needed to first clear the window Run your program to make sure it works Ask the u
7. gram our code is followed exactly In our programs we are telling the ClassPad exactly what to do and the ClassPad will do exactly what we tell it to do This is why entering text in the correct format is so important If you are interested in learning more about a particular command please try searching the ClassPad s User Manual PART In this part we will create a simple program 1 Naming a Program we Edit Run Menu a Click and then se Folder nS Folder main Trl b Click the G1 button oe Sa nre aA c Type in the name Hello Parameter d Click OK e The Program Editor K window opens This is where we input the code for a program Frogram Loader Frogram Loader 2 Entering Code to Display a Message a Open the I O menu and we Edit Ctrl select Output Print Enel prne AMSS b NOTICE Print was input Heto f with a space following it Printhatural The space is part of the Communication Print command s syntax and is needed c Type in Hello ClassPadder and press EXE d The quotes are needed to let the ClassPad know that Hello ClassPadder is a word not a variable Program Editar ein Program Editar Print Hello ClassPadder Copyright c 2008 CASIO COMPUTER CO LTD All Rights Reserved 2 3 Running a Program a os oo ze Click the button Click Yes to save your changes Click L amp 1 to run your program Click OK Click in the upper window Click LJ to
8. me ello O Paramete M Program Editor Hello ClassFadder Frogram Loader Using the Locate command to Print The Locate command lets us place output at a specific x y location on the screen For example Locate 10 20 abc places abc over 10 and down 20 from the upper left corner We can go as high as 290 for each location horizontal and vertical a Let s try to print Hello near the center of the display window Open the program editor select E Place the cursor below the Print line Open the I O menu and select Output Locate Notice a space following Locate This is part of the syntax Following Locate type in 80 50 Hello Click and Yes Click L amp I to run your program and click OK Not quite centered try changing the location and run again ED TEAS ee Hello NP ClrText Print Hello ClassPadder S 26 56 Hello Folder man T Mame Hella F m Frogram Editor Copyright c 2008 CASIO COMPUTER CO LTD All Rights Reserved 4 Button Review Click to create a new program Click to return to the program editor and edit a window Click to save changes and exit the program editor Click L amp I to run a program PART Practice Exercises Before beginning the practice exercises open a word document type in the following information and then save it as Lesson15 in your CASIO folder within My Documents e Date enter today s date e To put your instruc
9. run your program again Our 1 Hello still shows Click OK Run Hello a few more times Editing a Program a b C d You can type it in or select Click in the upper window Select to return to the Program Editor Click place focus below the Print line Input ClrText 1 O Clear CirText e Run the program again Click Yes and then L amp f Well what happened D TEAS eG fT Print Hello ClassPadder WARNING Save changes Frogram Editor EIG E Frogram Editor Our program did exactly what we told it to do First it printed Hello ClassPadder and then it cleared the window Folder main TF Mame Hello rl Hello ClassPadder Hello ClassPadder Hello ClassPadder Es ee 2 Folder main Trl Mame Hello fr But we would like it to first clear the window and then print Hello ClassPadder Hmmm Copyright c 2008 CASIO COMPUTER CO LTD All Rights Reserved 5 Editing a Program Continued Click in the upper window and select Delete CirText Put an empty line above Print Hello ClassPadder Click in the empty line Type in ClrText or select 1 O Clear ClrText Click the button Click Yes Click LJ to run your program and click OK Click in the upper window Click LJ to run your program again Only one Hello ClassPadder Edit Ctrl Miia Misc fl G A H ao Helo NP ClrText Print Hello ClassPadder Folder main T Na
10. ser to input their first test score by adding this line to your program Input a 1st Test Score This will store the user s first test score in the variable a Run your program to make sure it works With the input dialog showing get a screen capture Paste it into your Lesson15 document under a title of PART II Add two more lines of code to prompt the user for their 2 and 3 test scores Store the 2 test score in variable b and the 3 in variable c Hint select Input a 1 t Test Score copy it Ctri c paste it Ctri v twice and then change the a and 1st Run your program to make sure it works With your program showing get a screen capture Add two blank spaces following the first screen capture and then paste this one Now we need to average the user s test scores Input code to display the message Your test average is Add code to display their average by typing in Print at b c 3 Run your program and input 90 78 and 98 for the test scores Change Print a b c 3 to Print approx a b c 3 Run your program again With the average showing get a screen capture of your output window Add two blank spaces following the second screen capture and then paste this one Copyright c 2008 CASIO COMPUTER CO LTD All Rights Reserved 8 PART III A very important part of writing programs is to be able to do something based on a particular value For example checking to make sure the user is input
11. ting valid values Would it be reasonable for a user to input a test score of 20 or 152 Well 152 might be reasonable if the test was based on 200 points but 20 is not reasonable 1 The Ctri Menu wW Edit Be 10 Misc Click the D button Type in the name Temp Click OK Open the Ctrl menu and look around The Ctrl menu contains command statements that let us control what happens based on conditions anog SMELIEX Program Editor Frogram Editor cm 2 Using an If Then Statement We can use an If Then statement to check for valid input or perform different actions based on input The syntax of an If Then statement is as follows If something is true Then Do this Else AMSA Do this Meme Mo ee Foder man T I fEnd Name Temp T a Type in the program exactly as shown aoe Large number Print Small number b Run the program a few times Large number c Input at least one number greater than 10 and one number less than ten d Does the logic of the If Then statement Program Editor make sense Copyright c 2008 CASIO COMPUTER CO LTD All Rights Reserved 9 3 Walking Through a Program An excellent way to understand programming is to do what is called a code walk through To walk through code we make up values as needed and then walk the value through the code For example consider these programs a This is a walk through of program a shown below If we run this progr
12. tor s name here e From put your name here e Re Lesson 15 Begin a new program named Today by clicking and inputting the program name Input code to display the word Today in the upper left corner of the display window Remember to input the line of code needed to first clear the window Run your program With Today displaying in the output window get a screen capture Paste it into your Lesson15 document under a title of PART I Add a line of code to display is Tuesday or whatever day of the week it is for you on the next output line to be displayed Run your program With your new output showing get a screen capture Add two blank spaces following the first screen capture and then paste this one Add a line of code to display Today is Tuesday or some other day name so that it is centered in the output window Try to center it but it does not have to be perfect Once you are happy with your centering get a screen capture of your output window Add two blank spaces following the second screen capture and then paste this one Copyright c 2008 CASIO COMPUTER CO LTD All Rights Reserved 5 PART II In this part we will ask the user for input and then display a message using their input 1 Getting Input from the User lel A a ClrText Print Hello ClassFadder Print What is your name InputStr Mame Print Mame a Edit Run Open your Hello program again Select to edit the program
Download Pdf Manuals
Related Search
Related Contents
User`s Manual Sprint Nextel Q10 User's Manual Topcom Corded telephone - Deskmaster 4100 La Fonera User Manual Samsung Lavadora 13 kg WA15L3WDP Carga superior Manual de Usuario Computer Software - The Meaningful Learning Research Group Copyright © All rights reserved.
Failed to retrieve file