0 of 3 lessons complete (0%)

Writing and testing a Program in Flowgorithm

You don’t have access to this lesson
Please register or sign in to access the course content.

Flowgorithm is great for quickly prototyping (creating a working model[4] with some features) of a program.

It allows us to plan out the logic visually and then run the code.

The code created will not be as efficient as if we

We will make and run the program below.

This program takes a users name and age.

If the age is 18 or more the message “You are an adult!” is printed. Otherwise “Hey kiddo!” is printed

First add the variables[1] that we need[5].

name should be set to the type string[6] (text)

age should be set to the type integer[7] (whole numbers)

This will allow us to access the data[8] at a later point.

Add an output block with the message “Enter your name: “

Deselect New Line so that a new line is not entered.

Note that when printing strings (text) the content is contained within speech marks ” “

Now add an input block that is linked to the variable[2] name.

Whatever we type in will be saved in the variable name we created earlier.

For example if I type in Bob. name will contain the value Bob

There is a problem with Flowgorithm in that is is relatively simple in terms of the code if can create.

Printing out messages containing variables is one example of this.

Add two output blocks

The first output block should contain the string “Hello “

The second output block should have the variable that you want to print out.

Note here you just put the variable name. If we included ” ” it would treat it as a string.

Add an output message to ask the user for their age.

Now add in an input to read in the age and store in the variable age created earlier.

Now we will test the program to see if it works.

Click the play button.

Enter the required / requested inputs[9].

Now we need to add an if statement to check if the user is 18 or older.

Add an if block

Click on the If block

Enter the condition[3] (true / false statement) age >= 18

This is age is greater than or equal to 18

Now add output blocks to print the appropriate message.

Run your program with different inputs (names and ages) to test that it works correctly.

Activity

Write a program that will read in a persons first and last name and then print out their name in the following format.

firstname surname

surname firstname

Firstname: Bob

Surname: Danger

Bob Danger

Danger Bob

Terms definitions
2. variable. A placeholder for a piece of information that can change.
3. condition. A statement that a program checks to see if it is true or false. If true, an action is taken. Otherwise, the action is ignored.
4. model. A model is a physical representation of a technological solution[10] (sometimes scaled) that enables a solution’s feasibility to be tested/predicted.
5. need. An identified requirement of a person, group, or environment[12]. A need is identified from an issue[16] and sits within a context[17]. Technological practice[11] can be undertaken in an attempt to meet an identified need.
Terms definitions
1. variables. Flowgorithm is great for quickly prototyping (creating a working model with some features) of a program. It allows us to plan out the logic visually and then run the code. The code created will not be as efficient as if we We will make and run the program below. This program takes a users name […]
2. variable. Flowgorithm is great for quickly prototyping (creating a working model with some features) of a program. It allows us to plan out the logic visually and then run the code. The code created will not be as efficient as if we We will make and run the program below. This program takes a users name […]
3. condition. Flowgorithm is great for quickly prototyping (creating a working model with some features) of a program. It allows us to plan out the logic visually and then run the code. The code created will not be as efficient as if we We will make and run the program below. This program takes a users name […]
4. model. Flowgorithm is great for quickly prototyping (creating a working model with some features) of a program. It allows us to plan out the logic visually and then run the code. The code created will not be as efficient as if we We will make and run the program below. This program takes a users name […]
5. need. Flowgorithm is great for quickly prototyping (creating a working model with some features) of a program. It allows us to plan out the logic visually and then run the code. The code created will not be as efficient as if we We will make and run the program below. This program takes a users name […]