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 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 that we need.
name should be set to the type string (text)
age should be set to the type integer (whole numbers)
This will allow us to access the data 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 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.
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 (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.
Write a program that will read in a persons first and last name and then print out their name in the following format.