Professional Documents
Culture Documents
Assignment 1: Qualification BTEC Level 5 HND Diploma in Computing Unit Number and Title Submission Date
Assignment 1: Qualification BTEC Level 5 HND Diploma in Computing Unit Number and Title Submission Date
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
1
Summative Feedback: Resubmission Feedback:
2
Table of contents
3
2.2.6 Do-While statement...............................................................19
INDEX OF COMMENTS..................................................................27
4
Table of Figures
Figure 1: Programming language illustration.........................................................................................6
Figure 2 : How computer store and execute a program........................................................................6
Figure 3 : How computer can understand programming languages......................................................7
Figure 4 : Procedural oriented programing...........................................................................................7
Figure 5 : Simple program to display Hello world to the screen............................................................8
Figure 6 : Flow chart Hello, World! Program.........................................................................................8
Figure 7..................................................................................................................................................8
Figure 8..................................................................................................................................................9
Figure 9..................................................................................................................................................9
Figure 10..............................................................................................................................................10
Figure 11 : Three contructions in programming..................................................................................11
Figure 12 : Functions in Procedural Programming...............................................................................12
Figure 13 : Example for Parameter Passing.........................................................................................13
Figure 14 : Example about Data Type..................................................................................................13
Figure 15 : Modularity in Program.......................................................................................................14
Figure 16..............................................................................................................................................15
Figure 17..............................................................................................................................................15
Figure 18 : Example about Selection Structure....................................................................................16
Figure 19 : Switch Case Structures.......................................................................................................17
Figure 20..............................................................................................................................................17
Figure 21..............................................................................................................................................18
Figure 22 : The syntax of the for..........................................................................................................18
Figure 23 : Diagram for While Loop.....................................................................................................19
Figure 24 : Diagram for Do-While Loop...............................................................................................20
Figure 25..............................................................................................................................................20
Figure 26..............................................................................................................................................20
Figure 27..............................................................................................................................................21
Figure 28..............................................................................................................................................21
Figure 29 : Hierarchy Diagram of the Scenario Program......................................................................22
Figure 30 : Use Case Diagram for Scenario Program...........................................................................23
Figure 31 : Menu Operation Flow Chart..............................................................................................23
Figure 32 : Input Student List Flow Chart.............................................................................................24
Figure 33 : Display Students List Flow Chart........................................................................................25
Figure 34 : Find the Student with highest Grade Flow Chart...............................................................25
Figure 35 : Find the student with lowest Grade Flow Chart................................................................26
5
Task 1 . introduction to computer programming
languages,C languages and discuss key features of
procedural programming.
1.1. About programing languages.
Along with the development of technology, computers were born for us to use.
And so that the computer can understand what we want and do what we want.
Programming languages have been created for us to use so that computers can
understand us.
6
Figure 3 : How computer can understand programming languages
7
Figure 5 : Simple program to display Hello world to the screen
We can input different string inside quotation (“…”) to display the text to the screen.
1.2.2 Variable
in C language, variable is a named memory area so that when we want to use some
data value in our program for different purposes.
Figure 7
8
Variables declaration:
Figure 8
*Local variable
These variables are declared within the function and can’t be accessed outside the
function.
Figure 9
*Global variable
9
These variables can be accessed from anywhere in the program.
Figure 10
10
1.2.3 Three contructions(consequence, selection, iteration with 6 statements)
Based on specific reference source, there are the ways to control the lines of code
- Sequencing: This means that the computer will run your code in order, one line at a
time from the top to the bottom of your program. It will start at line 1, then execute line
2 then line 3 and so on till it reaches the last line of your program. (Anon., 2015)
- Selection: Sometimes you only want some lines of code to be run only if a condition is
met, otherwise you want the computer to ignore these lines and jump over them. This
is achieved using IF statements. e.g. If a condition is met then lines 4, 5, 6 are
executed otherwise the computer jumps to line 7 without even looking at line 4,5 and
6. (Anon., 2015)
- Iteration: Sometimes you want the computer to execute the same lines of code several
times. This is done using a loop. There are three types of loops: For loops, while loops
and repeat until loops. That’s handy as it enables you not to have to copy the same
lines of code many times. (Anon., 2015).
1.2.4 Functions
Function is a block of instructions that perform a certain function. In C
languages, it required at least one function, which is main() and additional
functions.
For different purposes, you can divide the code into separate functions.
11
Figure 12 : Functions in Procedural Programming
We have two methods to pass parameters from calling function to called function,
based on different reference sources.
12
1.2.6 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’”. (Bhatia, 2020)
13
1.2.8 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.” (Bhatia, 2020)
Out variables
14
Figure 16
This function will be responsible for displaying the menu and the programmed
options based on user requirements.
Figure 17
Case 3: Find and print the ID and the grades of student has highest grades.
Case 4: Find and print the ID and the grades of student has lowest grades.
15
Figure 18 : Example about Selection Structure
The switch case is used when we have multiple options and we want to compared the input value
with all the cases inside the switch..case block to execute different options.
16
Figure 19 : Switch Case Structures
If…else Structures to find the student have lowest grade the same with student have highest grade
with the condition is : the student in the current loop have grade lower than the grade of student in
the previous loop, then returns the student with the lower grade in current loop.
Figure 20
17
Figure 21
For helps us to display all student user add and find the students with the highest and lowest scores.
18
Figure 23 : Diagram for While Loop
Here, statements may be a single statement or a block of statements. The condition may be any
expression, and true is any nonzero value. The loop iterates while the condition is true.
When the condition becomes false, the program control passes to the line immediately following the
loop.
A do...while statement is similar to a while statement, except the fact that it is guaranteed to
execute at least one time.
19
Figure 24 : Diagram for Do-While Loop
Figure 25
idHtmh is an integer. If input idHtmh <0, return idHtmh and input again.
Figure 26
20
gradesHtmh is a float. Input grades.
Figure 27
Figure 28
21
Figure 29 : Hierarchy Diagram of the Scenario Program
22
Figure 30 : Use Case Diagram for Scenario Program
23
3.2.2 Flow Chart : Input Student’s ID And Grade
24
3.2.4 Flow Chart : Display Student List With Name, ID and Grade
25
3.2.6 Flow Chart : Find the Student with lowest Grade
26
Index of comments
27