September 21, 2024

Week 5 - Sequential coding in Raptor

CLASS OBJECTIVE

Recognize that when programming there are different techniques to write code, and the first is the sequential coding, which means that the code executes step by step from the start to the end, without alternate paths.


INTRODUCTION

Now you know how Raptor works: through the creation of flowcharts. Last class, Two new symbols were introduced to you, the input to collect information and the output to show the results.

Besides, there was another important concept that we have to reinforce: variables.


VARIABLE is a memory space reserved to save information. Before you start any process you have to declare variables, which means give them name and type. In the Raptor case you just have to name the memory space in an input or assignment.

perimeter ── 3.1416*radius

In the example, there are two variables, radius that already has information saved in it, and perimeter which is a new space of memory that will receive the result of the multiplication.


Variable names can't have special characters, such as @ *  #. The suggestion is to use lowercase letters and/or numbers, in this order, without spaces.

Tip: you can compare variables with cells in a spreadsheet. You can type information in them to save it, and any cell has its own name.



ACTIVITY

You'll create a program to calculate your first period average. Open raptor and start saving the file. Name it Average Calculator and your student number, example: Average Calculator 12345

  • Insert 12 Input symbols, one for each subject.
  • Configure each one of them to ask for the final subject score, and name the variable as the subject. Example, ask for "Español" final grading and save it in a variable named español.


  • Now, insert an assignment symbol after the input boxes. 
  • Configure it to add the 12 gradings and divide the result into 12. Assign the final average to a variable named periodaverage. As you can see, there is no space between the words.


  • For the last, insert an output symbol. Configure it to show the periodaverage variable.
  • Test the program and if it works send it to your teacher through Classroom.

 As you can see, this program executes every step, one by one, until the end. This is called sequential coding.

Next class we'll use the rhombus symbol once again to decide between different paths, by making decisions.



CLASS NOTES

As always, write down in your notebook the title of the class, the objective and follow the instructions.

  • What does "sequential coding" mean?
  • What is a variable?
  • Variable names must avoid special characters, Name at least 5 of these special characters.
  • Draw a flowchart, such as in the activity, to calculate the course average, asking for the three period averages.


HOMEWORK
You will do an investigation about Algorithms and Programs. Write down the next questions and anwer them in your notebook, using your own words.
  • What is the meanning of Algorithm?
  • What is the difference between Algorithm and Program?
  • Describe in your own words an algorithm to solve a home problem.