Professional Documents
Culture Documents
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Student’s signature
Grading grid
P1 P2 P3 M1 M2 D1
Summative Feedback: Resubmission Feedback:
INTRODUCTION
Programming is writing computer code to create a program, to solve a problem. Programs are created to
implement algorithms. Algorithms can be represented as pseudocode or a flowchart, and programming is
the translation of these into a computer program.
Simply put, procedural programming is laying down a list of instructions that teach the computer how to
complete a task step by step. (Bhatia, 2022)
Figure 1: Procedural Programming
Advantages
Disadvantages
2. Local Variable:
A local variable is a variable that is declared in the main structure of a method and is limited to the
local scope it is given. The local variable can only be used in the method it is defined in, and if it
were to be used outside the defined method, the code will cease to work.
3. Global Variable:
A global variable is a variable which is declared outside every other function defined in the code.
Due to this, global variables can be used in all functions, unlike a local variable.
4. Modularity:
Modularity is when two dissimilar systems have two different tasks at hand but are grouped
together to conclude a larger task first. Every group of systems then would have its own tasks
finished one after the other until all tasks are complete.
5. Parameter Passing:
Parameter Passing is a mechanism used to pass parameters to functions, subroutines or procedures.
Parameter Passing can be done through ‘pass by value’, ‘pass by reference’, ‘pass by result’, ‘pass
by value-result’ and ‘pass by the name’.
P2: Analysis
I. variables and data types required in the program.
Student ID ID Int
2. If
The If statement is in charge of changing a program's execution flow. A condition is always
used with an if statement. Before executing any statement within the body of If, the
condition is evaluated first. (Thompson, 2022)
III. iteration constructs
1. For
A for loop is a repetition control structure that allows you to efficiently write a loop that
needs to execute a specific number of times.
=> Go to step 5
Unlike the for statement, the Do-while statement checks the condition at the end of the
loop.
2. hierarchy diagram
Figure 4: hierarchy diagram
P3. Diagram
1. Action required
Figure 5: Action required
To save grades and student IDs in the program's memory, the teacher must first input them. The teacher
can then select any task, such as viewing all students' grades and IDs. Find the highest or lowest . After
selecting one of the alternatives, the application will return to the main menu, where you can select
another option or exit the program.
2. Main menu and displaying
Explain flowchart
Step 1: start
Step 2: Declare float int i, float grade
Step 3: check condition
Step 4: print ID and grade
Step 5: increase by 1
Step 6: go back step 3
Step 7. Go to step 4 if done step 6 and get true step 3
Step 8: end
4. Find highest grade and lowest grade
a. Find highest grade
Explain flowchart:
Step 1: start
Step 2: declare variable float max, int i
Step 3: check condition if true then go to next step, if false print max grade
Step 4: check condition max < list[i].grade. if true, set max = list[i].grade
Step 5: increased by 1 unit and repeat step 3
Step 6: end
b. Find lowest grade
Explain flowchart
Step 1: start
Step 2: declare variable float min, int i
Step 3: check condition if true then go to next step, if false print min grade
Step 4: check condition min > list[i].grade. if true, set min = list[i].grade
Step 5: increased by 1 unit and repeat step 3
Step 6: end
References
Bhatia, S., 2022. [Online]
Available at: https://hackr.io/blog/procedural-programming
[Accessed 14 june 2022].