The purpose of an algorithm

Algorithms are really intended as a blueprint for communication to programmers.

Example: Finding the area of a circle

Problem Definition: A solution is needed to find the area of a circle given a radius.

Solution as a flowchart

Solution in pseudocode:

START 
//variable declaration
float radius
float area
float pi  = 3.14

//input
print "Please enter a radius"
input radius

//processing
area = pi * radius * radius


//output
print "The area is : ", area

END

Actual program code in C:

#include <stdio.h>
#include <stdlib.h>

int main()
{
    float radius, area;
    const float pi = 3.14;
    //input
    printf ("Please enter a radius\n");
    scanf("%f", &radius);

    //processing
    area = pi *radius *radius;
    printf ("\nThe area is : %f", area);



    return 0;
}

Notice how similar the pseudocode is to the actual coded solution.

© 2022  Vedesh Kungebeharry. All rights reserved. 

SBA Marking – Spreadsheets

Marks were assigned on the 9th March 2022.

Videos below.

Group 1

https://youtu.be/QBVQRvTstO0

Group 2

https://youtu.be/u-CoLNecmg4

Group 3

https://youtu.be/TCAk5DQGSgk

Group 4

https://youtu.be/27PNckjqvOY

Group 5

https://youtu.be/Yt_kWC6fLgY

Note

Video feedback for group 6 and 7 was not posted due to an ongoing investigation into the authenticity of the submissions.

© 2022  Vedesh Kungebeharry. All rights reserved. 

Scratch: Drawing a Square, Square Variable exercise

Demo:
1. Visit Scratch.mit.edu or open scratch version 3
2. Add the pen addon to the scratch project
3. Experiment with the blocks that use the pen
4. Draw a square of side 50 units

Scratch Demo: https://scratch.mit.edu/projects/650520375

Video Demo:

Task: Prompt the user to enter a value and store it in a variable called “Side”. Proceed to draw a square with a length of side equal to “Side”. (Assume the user enters a size that can fit in the stage area.)

© 2022  Vedesh Kungebeharry. All rights reserved.